Descriptionstate/watcher: remove Sync
The intended difference between Sync and StartSync is that Sync makes
sure that all events have been sent on the out channel. This isn't
something that clients should be sensitive to.
But clients *can* tell when it starts to watch something if the watcher
is acting on old information or not (it affects the initial event)
and the old implementation of StartSync made that very hard to rely on.
So this CL removes Sync entirely as being misguided, but makes StartSync
itself more deterministic by ensuring that when the watcher loop receives
a sync request, it will not deal with any more events until it has
synchronised. Note that the new test in watcher_test.go consistently
failed with the old implementation.
Note that the state/presence package contains very similar logic
that should be changed in the same way. Until that is fixed, we use
Presence.Sync inside State.StartSync.
In the next CL after that one, I plan to rename StartSync to Sync
throughout, as there's no need for the "Start" qualification if there
is only one form.
https://code.launchpad.net/~rogpeppe/juju-core/372-startsync/+merge/181230
(do not edit description out of merge proposal)
Patch Set 1 #Patch Set 2 : state/watcher: remove Sync #Patch Set 3 : state/watcher: remove Sync #
Total comments: 4
Patch Set 4 : state/watcher: remove Sync #
MessagesTotal messages: 5
|