-
Notifications
You must be signed in to change notification settings - Fork 31
STITCH-2133 Add ability to unfreeze document via sync #73
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
Conversation
* @return true if successfully resumed, false if the document | ||
* could not be found or there was an error resuming | ||
*/ | ||
boolean resumeSyncForDocument(@NonNull final BsonValue documentId); |
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.
This is good. In addition to this, we need a way to get the Set of all documents that are frozen
} | ||
|
||
config.setPaused(false); | ||
return !config.isPaused(); |
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.
won't this always be true?
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.
Thought there's a small chance of a race here– document is resumed and in that instant an error occurs again. Returning !isPaused seemed like a sure way to return the state of the doc. I could leave a TODO for your threading ticket. Or I could be being overly careful here.
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.
I feel like it's fine to return true. The same thing can happen even right after it returns to you.
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.
Looking good, we just need the ability to list paused docs as well. My bad not specifying this in the ticket.
The main addition of this ticket is the added method
resumeSyncForDocument
. A major secondary change is that the language for "frozen/thawed" has been switched to "paused/resumed". This is the documentation for this method:This method is proxied upwards from
DataSynchronizer
=>CoreSync
=>Sync
.The tests assert that, in the event of an irrecoverable error, a document is paused, and that document can be resumed via this method. The method should return the appropriate boolean value if the resume was successful. Operations should then be able to be sync'd on said document.