graphql - await initial replication resolves on failed replication#2745
Merged
Conversation
Owner
|
Yes. Adding a timeout as attribute to |
Owner
|
Ah wait. I misread one part. |
Owner
|
I merged this one. Another PR for the timeout param is welcomed. |
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.
This PR contains:
Describe the problem you have without this PR
I experienced that
awaitInitialReplication()of the graphql replicator plugin resolves even if the replication never succeeds (see attached issue). Is this the expected behavior?Path of issue
syncGraphQL()executesreplication.run()(see code) without param and thus the defaultretryOnFail = trueis used. If this first pull cycle failsrun()is executed with the default param again (code). Works as expected.The problem is that
syncGraphQLexecutesrun(false)on every following pull sync cycle everyliveIntervalms (code). Ifrun(false)is executed and failsthis._run(retryOnFail=false)returns false, the following if check resolves andinitialReplicationCompleteemits true:(code)
Fix
Simply adding
retryOnFailto the if statement fixes the issue. Thus, only the initial replication cycle and every retry execution of run() are able to emittruetothis.subjects.initialReplicationComplete.Discuss
The current behavior of
awaitInitialReplication()is that it neither resolves nor rejects if the replication stays erroneous. I'm thinking about if it would be useful to reject the promise and cancel the whole replication after an specific timeout that can be set by the user because this timeout hardly depends on the amount of data pulled initially. Could be implemented withPromise.race()and an timeout Promise in theawaitInitialReplication()method. Looking forward to discus 👍Todos