Skip to content
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
merged 8 commits into from
Feb 10, 2022

Conversation

trevor-scheer
Copy link
Member

@trevor-scheer trevor-scheer commented Feb 10, 2022

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 an Unchanged 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.

@trevor-scheer 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
@codesandbox-ci
Copy link

codesandbox-ci bot commented 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.

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 trevor-scheer merged commit dea4f47 into version-0.x Feb 10, 2022
@trevor-scheer trevor-scheer deleted the trevor/fix-round-robin-issues branch February 10, 2022 21:37
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
Labels
↪️ port-to-2.x landed on 0.x but needs to be (forward) ported to 2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants