-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always report results in MVSQ when last reported value is unknown
LocalPropertyState and LabelsState were refactored to leave the responsibility of reporting initial results after waking up to the caller of onNodeEvents. This worked when the waking node created new MVSQ states in response to learning about new queries created while it was asleep. In that situation, new MVSQ state values were constructed, onNodeEvents would be called with an empty subscriber map for the initialization side effects, and then the results returned by readResults would be given to the new subscriber. This failed for MVSQ states that existed when the node went to sleep. Those states would be rehydrated, and they would receive the events as arguments to onNodeEvents during the usual runPostActions invocation. runPostActions would not call readResults on the outside, so if they were not reported inside onNodeEvents, they would just be dropped. The goal of the refactor was to reduce conditional logic in onNodeEvents that detected whether it was being used just for initialization. Instead, the result reporting was made unconditional, but when initializing, the subscriber collection was made empty, making it a noop. The assumption was that reporting results would be done on the outside. This change removes the assumption that not knowing what you reported last means the state can leave the reporting to the caller. In the face of uncertainty, the MVSQ states are now always responsible for reporting results. When being initialized, this is harmless, since the subscribers are blanked out. When being rehydrated and receiving events, this makes the MVSQ states always produce the necessary results. GitOrigin-RevId: b9aa2222df7688bce8a3631f1ea58e6c2047b259
- Loading branch information
1 parent
76d231a
commit 0566d7c
Showing
4 changed files
with
73 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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