-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(@aws-amplify/datastore): fix consecutive updates #7354
Conversation
Codecov Report
@@ Coverage Diff @@
## main #7354 +/- ##
==========================================
+ Coverage 74.24% 74.80% +0.56%
==========================================
Files 215 215
Lines 13471 13522 +51
Branches 2647 2661 +14
==========================================
+ Hits 10001 10115 +114
+ Misses 3272 3208 -64
- Partials 198 199 +1
Continue to review full report at Codecov.
|
Been wondering about this, how do iOS and Android library counterpart deal with such issue? tagging @jamesonwilliams perhaps he can share some insides from the Android side. |
@nubpro they most likely have the same issue on iOS and Android. We're going to sync up on this across teams after the holidays. |
2761fda
to
01129ce
Compare
This pull request introduces 1 alert when merging 01129ce into 286c9e8 - view on LGTM.com new alerts:
|
01129ce
to
d939a1c
Compare
This pull request introduces 1 alert when merging d939a1c into 651c3b2 - view on LGTM.com new alerts:
|
9d69cef
to
f87c7b7
Compare
Hi guys! Does anybody know when this fix will be added to the new Amplify release? I am using the iOS Amplify SDK and also got the same issue. It is blocker for us. Will this fix also applied for iOS version? |
697bba0
to
a51d735
Compare
@kylanry, yes, this fix will be applied across the Amplify libraries (JS, iOS, Android, Flutter). We're making some final modifications to the solution and are planning on releasing it soon. |
9b5a28c
to
9c12c6a
Compare
@manueliglesias @amhinson - this is ready for review now 😸
|
47bc314
to
f4d5516
Compare
a5f16ca
to
ef7612b
Compare
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.
Looks good to me 👍 Great job on the tests!
Just want to drop by to say that the included diagrams are supppper duper helpful, I wish there's more......could you guys spill more beans on the rest of datastore ins and outs? I was gonna try to understand the solution u guys came out with and honestly, I wasn't able to totally comprehend them. |
ef7612b
to
b900a46
Compare
b900a46
to
57c008e
Compare
57c008e
to
53989a5
Compare
This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Issue #, if available: #6363
Currently, if we run the following code in DataStore:
...the name of our Todo will be
'B'
after all AppSync requests are resolved, i.e., latter updates get ignored.The expected behavior is for
name
to be'D'
.Here's a sequence diagram detailing the current behavior (abstracted/simplified):
It happens on both fast and slow networks.
Fast (~500 Mbps):
Slow (10 Kbps):
Proposal
Reconcile the version of update mutations in the mutation queue when an AppSync mutation for the same model ID resolves.
Diagram of updated behavior:
Here's the same example running with the code in this PR:
Fast (~500 Mbps):
Slow (10 Kbps):
Note: the
_version
in the response will only be synced to related items in the queue when the AppSync mutation response contains the same item that was sent in the request, i.e., if the original mutation was sent by the same client.In the event of a handled conflict, where the response payload is different from the request payload, we do not sync the
_version
and subsequent writes will effectively be discarded.Sequence diagram for multi-client behavior:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.