HomePhabricator

[chronik-client] Patch failoverProxy to recognize another type of server failure

Description

[chronik-client] Patch failoverProxy to recognize another type of server failure

Summary:
We have a challenge with failoverProxy in that some chronik errors are the result of bad input (for example we try to get a tx with a bad txid) and other errors are server errors.

We only want to "try the next server" when we have a server error. So, we need some kind of filter where we only do this on a server error.

Our current criteria comes from real world experience, i.e. seeing how servers fail and isolating those error msgs. Today, observed a new type of failure. chronik-native3 returns a normal failure msg but without a reason. I also observed this in servers that are reachable but indexing.

Add this condition.

Test Plan:
npm test and CI to confirm current behavior is not impacted.

Using 3.0.0 chronik-client:
Create a chronik url array with chronik-native3 during node maintenance as the first server and another reachable server as the second server. Attempt a normal tx call. Note that failover proxy does not go to the next server.

Using this version:
Do the same thing and note a switch occurs, we do get the tx

Try the same thing with a bad request i.e. chronik.tx('notatxid') and observe the server does switch over from native-3 but not from the next one in the stack; instead that error is returned

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Differential Revision: https://reviews.bitcoinabc.org/D17814

Details

Provenance
bytesofmanAuthored on Mon, Mar 17, 23:10
bytesofmanPushed on Tue, Mar 18, 19:05
Reviewer
Restricted Project
Differential Revision
D17814: [chronik-client] Patch failoverProxy to recognize another type of server failure
Parents
rABC88dc412d3367: [avalanche] Improve performance of inventory filtering
Branches
Unknown
Tags
Unknown