-
-
Notifications
You must be signed in to change notification settings - Fork 69
Add batch transactions #89
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@TomWFox can you look through the documentation when you get a chance? |
Codecov Report
@@ Coverage Diff @@
## main #89 +/- ##
==========================================
+ Coverage 78.75% 79.04% +0.28%
==========================================
Files 63 63
Lines 5042 5115 +73
==========================================
+ Hits 3971 4043 +72
- Misses 1071 1072 +1
Continue to review full report at Codecov.
|
@davimacedo @dplewis the way to leverage server level transactions from the client side seemed to be intuitive when I took a look. Where it seemed to get tricky (from your discussions on the server and JS SDK) is when handling unsaved child objects and possibly running into batch limits? Is there anything I missed or should be on the lookout for? One possible issue I can see coming up is when unsaved child objects are involved, the saving of those children are essentially mini transactions, meaning that if batch1 of children save correctly, but batch2 (say the parent objects) fails, transaction 1 was still committed to the DB. This may confuse the developer because not be thinking in terms of children/parent. This essentially acts "almost" like a regular batch without transactions, but gives you slightly more benefits as the second batch is reverted. Is this correct? If so, I don't see it as much of a problem and can't really think of a workaround on the server level (seems you need to cache some transaction list or something similar). It might be easier to do this on the client side though. Basically, if the client hits an error in batch2, they call deleteAll for batch1. Though, they might need the Above does make wonder though if you can use the UUID of the idempotent feature that @mtrezza added to Question about batch limits, I've seen in the iOS and Android SDKs a batch limit of 50, but see the JS mention 100. The JS SDK seems to have a way to change this. Parse-Swift has a way to change it as well. Is there a real sever limit or was that left over from Parse.com? If there is a limit, I assumed this can be configured by the developer, and hinted towards this in the docs. One of things I did was change the batch limit to whatever the transaction size is: Parse-Swift/Sources/ParseSwift/Objects/ParseObject.swift Lines 123 to 128 in 8939e47
I also added this warning in the docs: Parse-Swift/Sources/ParseSwift/Objects/ParseObject.swift Lines 71 to 73 in 8939e47
Let me know what you think and I'm interested in hearing any limitations/problems you see. Linking parse-community/Parse-SDK-JS#1090 as these PRs overlap in "how to design" |
Noting a comment from @davimacedo in the linked PR:
If this bug still exists, I can remove transactions for |
Support for batch transactions parse-community/parse-server#5849
saveAll
anddeleteAll
batchLimit
argument to all publisher (SwiftUI)saveAll
anddeleteAll
(this was an oversight when adding publishers)Pointer
example by querying withinclude
andincludeAll