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

GraphQL replication: should stop syncing if we receive less docs than pull.batchSize #4110

Closed
wants to merge 2 commits into from

Conversation

jwallet
Copy link
Contributor

@jwallet jwallet commented Nov 6, 2022

This PR contains:

  • IMPROVED TESTS (fail test)

Describe the problem you have without this PR

If we send the initialSync with a batchSize of 5, the server last response will contain less than the batchSize (let say 2) and instead of finishing the initial replication, rxdb will always request a last time because it ends only if there are no document in the response. Actually the batchSize interface tells us, that the replication will stops if the response contains less documents than the batchSize, which is currently not true

It will also be preferrable to resolve this case, cause we also prevent relying on the server to stop the sync process.
Currently we have, at work, a endpoint that need to be fix, it includes in the response the document that fits the checkpoint.updatedAt, so the initialSync() never stop.

  • Tests

@jwallet
Copy link
Contributor Author

jwallet commented Nov 6, 2022

sorry I'm not familiar with karma, I didn't find the equivalent of jest.fn() and expect().toHaveBeenCalledTimes(2). so I used a goold old count++

@pubkey
Copy link
Owner

pubkey commented Nov 6, 2022

Can you set live: false and check if that also fails?
This would ensure that no time dependend other sync-cycle is running.

@jwallet jwallet changed the title GraphQL replication: should stop syncing if we received less docs than pull.batchSize GraphQL replication: should stop syncing if we receive less docs than pull.batchSize Nov 6, 2022
@pubkey pubkey mentioned this pull request Nov 7, 2022
@pubkey pubkey closed this in #4116 Nov 7, 2022
pubkey added a commit that referenced this pull request Nov 7, 2022
* GraphQL replication: should stop syncing if we received less docs than pull.batchSize

* moved test to only pull live "false"

* ADD fix

Co-authored-by: Wallet <joseouellet@gmail.com>
@pubkey
Copy link
Owner

pubkey commented Nov 7, 2022

Fixed here #4116

@jwallet
Copy link
Contributor Author

jwallet commented Nov 7, 2022

thanks @pubkey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants