-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gateway): Resolve gateway retry issues (UplinkFetcher failed to update...
) (version-0.x
)
#1503
Merged
Conversation
This file contains 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
trevor-scheer
added
the
↪️ port-to-2.x
landed on 0.x but needs to be (forward) ported to 2.x
label
Feb 10, 2022
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
glasser
requested changes
Feb 10, 2022
gateway-js/src/supergraphManagers/UplinkFetcher/loadSupergraphSdlFromStorage.ts
Outdated
Show resolved
Hide resolved
gateway-js/src/supergraphManagers/UplinkFetcher/loadSupergraphSdlFromStorage.ts
Show resolved
Hide resolved
trevor-scheer
force-pushed
the
trevor/fix-round-robin-issues
branch
from
February 10, 2022 20:46
bd1f707
to
781b317
Compare
The current gateway supergraph fetch retry logic doesn't handle the `null` case correctly. It treats `null` as a retry-able result, when it's actually the most common case (meaning no schema change). In the success case (result = SupergraphSdlUpdate | null) we now clear any exceptions that may have been caught during retry so that they aren't thrown. This also introduces the `async-retry` package which nicely wraps the retry logic for us and manages exponential backoff.
trevor-scheer
force-pushed
the
trevor/fix-round-robin-issues
branch
from
February 10, 2022 21:14
bc82b5c
to
39b9ffb
Compare
glasser
approved these changes
Feb 10, 2022
gateway-js/src/supergraphManagers/UplinkFetcher/__tests__/loadSupergraphSdlFromStorage.test.ts
Show resolved
Hide resolved
trevor-scheer
added a commit
that referenced
this pull request
Feb 10, 2022
…update...`) (`version-0.x`) (#1503) The current gateway supergraph fetch retry logic doesn't handle the `null` case correctly. It treats `null` as a retry-able result, when it's actually the most common case (meaning no schema change). In the failure case we now throw the most frequently occurring error (via the `async-retry`). This also introduces the `async-retry` package which nicely wraps the retry logic for us and manages exponential backoff.
trevor-scheer
added a commit
that referenced
this pull request
Feb 10, 2022
…update...`) (`version-0.x`)(#1504) Forward port of #1503 The current gateway supergraph fetch retry logic doesn't handle the `null` case correctly. It treats `null` as a retry-able result, when it's actually the most common case (meaning no schema change). In the failure case we now throw the most frequently occurring error (via the `async-retry`). This also introduces the `async-retry` package which nicely wraps the retry logic for us and manages exponential backoff.
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.
Currently the gateway implements incorrect retry logic. The
null
response case (no schema change found) is handled as a retry-able result (or failure case) when really it should be handled as a success and result in completing the current retry sequence with no errors thrown.It's worth mentioning that this issue should have never affected gateway load/startup (only update), since the gateway has no
ifAfterId
to send to our server and thus should never expect anUnchanged
result from its initial request. It should also have never affected gateway updates since in the update case the result would be non-null and escape the retry case. All this is to say, gateway function should have been unaffected due to this issue, but it did log errors even from the happy path (successful retry after an error).Additionally, this PR introduces the
async-retry
package which wraps the retry logic for us and handles exponential backoff.