DefiantLabs / cosmos-tax-cli

An opensource cosmos tax tool!
https://defiantlabs.net
Apache License 2.0
25 stars 7 forks source link

Feat/rpc incremental backoff for BlockResult querying #467

Closed pharr117 closed 1 year ago

pharr117 commented 1 year ago

This feature PR adds exponential backoff to BlockResults querying in the Block Event and Epoch Event indexers.

The feature works like the following:

  1. Indexer takes in 2 new configs:
    • rpc-retry-attempts: The number of attempts to be made when retrying. -1 will retry indefinitely
    • rpc-retry-max-wait: The maximum wait time that the algorithm will backoff to
  2. A wrapper around block_result server querying that will reattempt the query like so:
    • If retry attempts = 0, it will not retry
    • If retry attempts > 0, it will retry up to the amount of retries specified
    • If retry attempts < 0, it will retry indefinitely
    • The amount to wait is calculated as an exponential backoff, which means it will slow down the queries as it makes more and more. The retry max wait config controls how high the wait time will go.

This PR also moves some code around that should not be in the Osmosis subpackage as it was code for doing RPC server queries for block results.