-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Parse.Object.saveAll can result in duplicate objects #859
Comments
Thanks for opening this issue!
|
Could you please fill out the template to describe the issue and indicate whether you can reproduce the issue, see checkbox at the top. If the issue does not exist in the latest version, we may close this issue and related PRs. |
Here is a video explaining the issue https://www.loom.com/share/9744297bacfd41f3bd18e60527f0eacc |
Thanks for updating the issue.
This sounds like a bug, because duplicate objects would hardly be an intended outcome. So maybe we don't need a new I've classified this as a bug with severity:medium, as the workaround is to not use |
@mtrezza I guess it is debatable if it is a bug or not... but the issue stems from the fact that the saveAll call is a batch call, so if there is an error, the entire batch gets resent. The PR we have proposed used individual |
Can you think of a use case in which one desires this behavior leading to duplicate objects? My assumption would rather be the opposite, like you pointed out in your issue. |
ok - point taken. It's a bug. Just surprised no-one else has reported it in the last ~10 years! |
Well, if we had an "archeological bug excavator" badge, you would be the first to get it 🙂 |
I have had a very quick look at the batch saving and it think it would be possible to change that logic from using the But I guess the first step is an agreement (from you guys who have to see the big picture on the overall direction of changes) that in principal that is the correct approach... I imaging the reason for using |
you could argue that the same risk exists that if there is a network interruption during the individual save, you could equally end up with duplicate objects on the server. This is true. However, the 'damage' is reduced to just one (or two) duplicates, not 20 (default batch size?). |
That is why the idempotency feature has been introduced. However, there is a difference between what you originally described in your issue and your last comment:
Some thoughts:
My suggestion is that we just add a caveat warning to the |
@simonaberry Kindly let me know if you agree with the suggestion above and whether we can regard this issue as merely a "docs" issue. |
@mtrezza yes - I think your summary of the issue above is good and logical. We have already resolved the problem ourselves by building our own error handling logic - but at the price of multiple requests. So yes - happy that we just improve the documentation to make everyone aware of the potential downsides of |
New Issue Checklist
Issue Description
this issue has been specifically created to reference in this PR
Parse.Object.saveAll
uses the/batch
endpointif you have a large batch of large objects that are being saved via
saveAll
, and the network quality is very slow, it can happen that the initial request times out, and will therefore be automatically retried. However, some of the objects in the first batch may have already been successfully saved - but then the second retry would result in duplicate objects being created.Steps to reproduce
Watch this Loom
Actual Outcome
duplicate objects created
Expected Outcome
no duplicate objects
Environment
JS SDK used in web client, over spotty networks
Server
any
browser
remote
Database
mongo
any
remote
Client
latest
Logs
The text was updated successfully, but these errors were encountered: