-
-
Notifications
You must be signed in to change notification settings - Fork 594
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: Parse.Object.saveEventually
fails if server is restarting while calling it
#2090
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,9 @@ | |
toJSON() { | ||
return this.attributes; | ||
} | ||
_getSaveJSON() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the diff to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main thing that makes this work is that When using saveEventually and connection is down, the object gets stored in the queue as json. Today it uses 'getJSON' and that includes a json representation of ACL. This json object is later used (line 276) to save the queued object when the server is back up:
save here does not support ACL in json format (or ACL at all, don't think you can change access outside of server). There are TBH probably even better fixes here. We should probably only store the dirty fields of the object and not overwrite everything (but it does already make sure before line 276 that its not overwriting other things). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reason why the EventuallyQueue tests didn't catch this is because ACLs aren't on the objects before they are loaded from the servers. Doing this..
Would work fine. But in reality you often modify existing objects. When objects are loaded from server, the
All tests in example:
|
||
return this.attributes; | ||
Check failure on line 29 in src/__tests__/EventuallyQueue-test.js GitHub Actions / build (Node 18, 18.19.0)
|
||
} | ||
static extend(className) { | ||
class MockSubclass { | ||
constructor() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mortenmo Thanks for the PR! I think the validation check on ACL should removed instead of removing ACL from Eventually Queue. I honestly don't know why the ACL check is there.
.validate
is called in bothsave
andset
,save
also callsset
.set
transform the ACL json intoParse.ACL
(which has it own checks) then performs the.validate
then throws the error.The following integration test fails.
Here is an integration test replicate the issue for this PR.
Removing the ACL check will fix this issue.