Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4423)

Issue 13089045: state/watcher: remove Sync

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by rog
Modified:
10 years, 8 months ago
Reviewers:
mue, mp+181230, jameinel
Visibility:
Public.

Description

state/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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -115 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/jujud/machine_test.go View 2 chunks +2 lines, -2 lines 0 comments Download
M state/api/watcher/watcher_test.go View 2 chunks +3 lines, -3 lines 0 comments Download
M state/apiserver/server_test.go View 3 chunks +4 lines, -4 lines 0 comments Download
M state/machine_test.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M state/state.go View 1 1 chunk +0 lines, -7 lines 0 comments Download
M state/state_test.go View 3 chunks +3 lines, -3 lines 0 comments Download
M state/testing/watcher.go View 5 chunks +14 lines, -6 lines 0 comments Download
M state/unit_test.go View 1 2 chunks +3 lines, -2 lines 0 comments Download
M state/watcher.go View 1 2 3 3 chunks +9 lines, -6 lines 0 comments Download
M state/watcher/watcher.go View 7 chunks +20 lines, -39 lines 0 comments Download
M state/watcher/watcher_test.go View 7 chunks +32 lines, -34 lines 0 comments Download
M worker/uniter/filter_test.go View 6 chunks +6 lines, -6 lines 0 comments Download
M worker/upgrader/upgrader_test.go View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5
rog
Please take a look.
10 years, 8 months ago (2013-08-21 09:32:49 UTC) #1
mue
On 2013/08/21 09:32:49, rog wrote: > Please take a look. LGTM, I only have a ...
10 years, 8 months ago (2013-08-21 09:55:16 UTC) #2
jameinel
LGTM I'm a little concerned that we didn't add a test for the LifeCycleWatcher change, ...
10 years, 8 months ago (2013-08-21 13:00:48 UTC) #3
jameinel
So I was wrong about what class was getting collection. Just a suggestion that you ...
10 years, 8 months ago (2013-08-21 13:15:36 UTC) #4
rog
10 years, 8 months ago (2013-08-21 15:18:12 UTC) #5
Please take a look.

https://codereview.appspot.com/13089045/diff/5001/state/watcher.go
File state/watcher.go (right):

https://codereview.appspot.com/13089045/diff/5001/state/watcher.go#newcode1274
state/watcher.go:1274: // Simply emit event for each change.
On 2013/08/21 13:15:36, jameinel wrote:
> Given we are collecting here, is this a correct comment now?

good point. done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b