fix(routerlicious-driver): retry transient network errors in restWrapper#27631
Open
arafat-java wants to merge 1 commit into
Open
Conversation
Ported from a fix validated in a downstream fork (concurrent-editing microsoft#232), adapted to this repo's current restWrapper.ts/restWrapper.spec.ts conventions.
Contributor
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (212 lines, 2 files), I've queued these reviewers:
How this works
|
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.
How contribute to this repo.
Guidelines for Pull Requests.
Description
Port of a fix validated in a downstream fork (concurrent-editing, commit f71f3c4), adapted to this repo's current
restWrapper.ts/restWrapper.spec.tsconventions (which have diverged from the vendored copy — different imports, sinon-based test mocking instead of nock).The routerlicious driver can run in environments (e.g. AWS Lambda) where the execution context is frozen between invocations. A keep-alive socket pooled by the underlying fetch transport can be closed by the peer (e.g. an ALB) during the freeze; the next request reuses the dead socket and rejects with "socket hang up" / ECONNRESET / EPIPE.
request()now retries such transient network errors on a fresh socket, up to 3 attempts (1 initial + 2 retries, 250ms apart), before surfacing the error. A self-signed-certificate failure is excluded from retry since it's permanent, not transient.Reviewer Guidance
The review process is outlined on this wiki page.
The retry bound (3 attempts) and delay (250ms) were chosen empirically in the downstream fork; happy to discuss if a different value/backoff strategy is preferred. This was authored in an environment without network access to build/test locally — CI will be the first real verification.