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

Mark outgoing mutation as inProcess if nextEventPromise exists #392

Merged
merged 1 commit into from
Apr 21, 2020

Conversation

wooj2
Copy link
Contributor

@wooj2 wooj2 commented Apr 18, 2020

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@wooj2 wooj2 changed the base branch from master to master-clearStateME April 18, 2020 21:03
@wooj2 wooj2 requested a review from palpatim April 18, 2020 21:03
@wooj2 wooj2 force-pushed the master-clearStateME branch 2 times, most recently from a1e80f1 to 82c2a84 Compare April 18, 2020 22:48
@wooj2 wooj2 changed the title Master clear state me mark in prog Clear inProcess state on startup of outgoing mutation queue Apr 18, 2020
@wooj2 wooj2 force-pushed the master-clearStateME-markInProg branch from 57a0b1f to ff93b5d Compare April 18, 2020 23:23
@wooj2 wooj2 changed the title Clear inProcess state on startup of outgoing mutation queue Mark outgoing mutation as inProcess if nextEventPromise exists Apr 18, 2020
@wooj2 wooj2 added datastore Issues related to the DataStore category bug Something isn't working labels Apr 18, 2020
storageAdapter.save(mutationEvent, condition: nil) { result in
var eventToPersist = mutationEvent
if nextEventPromise != nil {
eventToPersist.inProcess = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to clarify if I understand it correctly. This is important in case the mutation event fails so it can be retried later on, is that a correct statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, that is not a correct statement.

To give you a little bit more context, this code should actually be refactored, and technically doesn't belong here. nextEventPromise is assigned if the outgoingMutationQueue asks the AWSMutationDatabaseAdapter for a mutationEvent to be sent out, but the AWSMutationDatabaseAdapter doesn't have an event to offer up. So, when this happens, the AWSMutationDatabaseAdapter saves this promise, and offers up an event when a mutationEvent is ready to be sent out (e.g. customer makes a mutation).

We can sync offline on this, and I can show you a component diagram of various pieces at work here.

@wooj2 wooj2 force-pushed the master-clearStateME branch from 82c2a84 to 3436602 Compare April 21, 2020 20:36
@wooj2 wooj2 force-pushed the master-clearStateME-markInProg branch from ff93b5d to ce7f310 Compare April 21, 2020 20:37
@wooj2 wooj2 changed the base branch from master-clearStateME to master April 21, 2020 20:51
@wooj2 wooj2 force-pushed the master-clearStateME-markInProg branch from ce7f310 to b5ecfe6 Compare April 21, 2020 20:52
@wooj2 wooj2 merged commit 3986cf5 into master Apr 21, 2020
@wooj2 wooj2 deleted the master-clearStateME-markInProg branch April 21, 2020 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datastore Issues related to the DataStore category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants