Add per-request timeout and failover to sync client - #20
Open
j0ntz wants to merge 1 commit into
Open
Conversation
A silently-dead sync server (one that accepts or drops the connection without ever responding) had no fetch timeout, so createRepo/readRepo/ updateRepo hung forever and the shuffled failover loop never advanced. This re-created the login-server outage on any dead server, prod included. Race each request against a configurable timeout (requestTimeoutMs, default 10s) so a dead server rejects with a NetworkError and the caller fails over to the next server within seconds.
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Description
Asana: https://app.asana.com/0/1215088146871429/1217058350202033
createRepo/readRepo/updateRepohad no per-request fetch timeout. A sync server that accepts or silently drops the connection without ever responding hungloggedRequestforever, so the shuffled failover loop never advanced to the next server. This re-created the login-server outage (a powered-offsync-tester-eustill listed in the config) on any silently-dead sync server, production included.Changes:
requestTimeoutMstoSyncClientOptions(default10000).loggedRequest(Promise.race, since the injectedFetchFunctionis not guaranteed to honor anAbortSignal— serverlet 0.1.0'sFetchOptionshas nosignal). On timeout the request rejects with aNetworkErrorand the caller fails over to the next server within seconds.Consumer follow-up (separate): bump this dep in edge-login-server and deploy.
Testing
test/unit/sync-client.test.ts) injects afetchwhose first server hangs past a shortenedrequestTimeoutMsand whose second server responds; assertscreateRepofails over to the second server, both servers were tried, and the elapsed time is bounded by the timeout (not the full hang). Also covers the no-timeout happy path.npm test(nyc + mocha), eslint,tsc, and rollup build all pass viaverify-repo.sh.