Buffer if clearing fix - #277
Merged
RolandPheasant merged 3 commits intoSep 23, 2019
Merged
Conversation
If only a pause observable was provided, the method signatures were ambiguous
The internal buffer storage list was directly passed to the outgoing ChangeSet, so when cleared it would affect callbacks processing downstream. Would become most apparent if ObserveOn was used that delayed the processing of the ChangeSet
…emarbles#275 Just copied the cache setup with a few tweaks
glennawatson
requested changes
Sep 22, 2019
This was referenced Sep 23, 2019
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What kind of change does this PR introduce?
A hopeful fix for ObservableList BufferIf usage being more reliable downstream, especially when used /w delaying calls like ObserveOn.
The change makes a new list for the internal buffer when firing, rather than reusing the same list that was provided to ChangeSet.
What is the current behavior?
Current behavior reuses the same internal buffer list for the outgoing ChangeSet that it is firing. This meant that the subsequent Clear() call on the buffer list would clear the ChangeSet as well, as it was the same list. This only became a problem if the ChangeSet consumption was delayed by an ObserveOn call or something similar.
What is the new behavior?
When executing an event, it passes the internal buffer to the ChangeSet to be used directly. A new list is then created for the internal buffer variable to be filled with new data.
An alternate route could have been constructing a new list and copying over the buffer's data to be given to the ChangeSet, and then clearing the buffer. The current setup felt like less processing with the same results.
What might this PR break?
ObservableList BufferIf calls in general. Might not be a full fix for all possible threading scenarios. Might be some oddball edge cases not yet considered.
Please check if the PR fulfills these requirements