Page MenuHomePhabricator

[chronik-client] Add timeout failure to ws connections
ClosedPublic

Authored by bytesofman on Mar 23 2024, 21:50.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABC0a5b61cb244e: [chronik-client] Add timeout failure to ws connections
Summary

In local testing, occasionally a ws will hang and fail to connect. In this case, we should try the next ws.

Test Plan

npm test

I have used this while locally testing Cashtab and can confirm the timeout failures will cause failover proxy to use the next ws. We may want to tweak the timeout depending on behavior we see with apps.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

clean up interval if we do not hit it

Failed tests logs:

====== Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 send tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 send tx from the mempool" ======
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/work/modules/chronik-client/test/integration/token_slp_nft1.ts)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)

Each failure log is accessible here:
Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 send tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 send tx from the mempool"

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
emack requested changes to this revision.Mar 24 2024, 02:12
emack added a subscriber: emack.
emack added inline comments.
modules/chronik-client/src/failoverProxy.ts
211 ↗(On Diff #46411)

since the plan is to tweak this based on app behavior, put the 5000ms in a config file

This revision now requires changes to proceed.Mar 24 2024, 02:12

define ws timeout as a constant

bytesofman added inline comments.
modules/chronik-client/src/failoverProxy.ts
211 ↗(On Diff #46411)

only used in one place. I don't think we want a config file for a dev library like this one.

will fix the magic number thing tho.

This revision is now accepted and ready to land.Mar 24 2024, 13:20
This revision was automatically updated to reflect the committed changes.
bytesofman marked an inline comment as done.