fix DontAnnounce policy drops documents synced by clients#86
Merged
Conversation
Problem: when we receive a sync message for a document which we don't have in storage and for whom the AnnouncePolicy returns DontAnnounce then we erroneously decide that the document is unavailable even if the incoming sync message contains data about the document. This is because we fail to process pending sync messages once the load has completed if we don't have the document available or any connected peers who we could request from. Solution: process pending sync messages before deciding that the document is unavailable. Whilst I'm here I also cleaned up the logic around the phase transition during load to make it more consistent with the rest of the phase transitions and easier to read. One important improvement is that if the document state changes mutliple times in one turn of a document actor, we only notify of the last status. This is important because it means that if a document transitions from loading through not found and into requesting in the same turn (which can happen if a load completes after receiving a sync message) then we don't notify the hub of the not found state. This is in turn important because notifying the hub of a not found state causes any outstanding find commands to complete with `None`. Fixes: #85 Co-authored-by: Carlos Scheidegger <285675+cscheid@users.noreply.github.com> Co-authored-by: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com>
010aca7 to
0d7cfde
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: when we receive a sync message for a document which we don't have in storage and for whom the AnnouncePolicy returns DontAnnounce then we erroneously decide that the document is unavailable even if the incoming sync message contains data about the document. This is because we fail to process pending sync messages once the load has completed if we don't have the document available or any connected peers who we could request from.
Solution: process pending sync messages before deciding that the document is unavailable.
Whilst I'm here I also cleaned up the logic around the phase transition during load to make it more consistent with the rest of the phase transitions and easier to read.
Fixes: #85