-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add StartContext, remove Stop #147
Conversation
1697e6e
to
6c90b74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for now, but still thinking about alternative ways to validate what we want with a test.
stats_test.go
Outdated
if realStore.stop != nil { | ||
t.Errorf("expected stop channel to be nil") | ||
} | ||
realStore.wg.Wait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a timeout? something like:
realStore.wg.Wait() | |
done := make(chan struct{}) | |
go func() { | |
defer close(done) | |
realStore.wg.Wait() | |
}() | |
select { | |
case <-done: | |
case <-time.After(1 * time.Second): | |
t.Errorf("blocked for too long waiting for stopped store") | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already precedent on another test to just call Wait() and potentially hang forever, so going to be consistent.
33064f8
to
3948144
Compare
This change removes the Stop() method from the previous change, and fixes the Start behavior to be backwards compatible. The previous change changed the behavior of Start() to be non-blocking from blocking. This is a change in API that we should revert. Stop is also removed - even though this too is a breaking change this is not a 1.0 release and the release is short-lived as of right now. This change introduces a new method, StartContext, which should achieve the goals from the last change, but retain backwards compatibility. StartContext is a blocking call like Start is, but allows for a context to be passed in, thus allowing for cancellation.
3948144
to
0663279
Compare
This change removes the Stop() method from the previous change, and fixes the Start behavior to be backwards compatible.
The previous change changed the behavior of Start() to be non-blocking from blocking. This is a change in API that we should revert. Stop is also removed - even though this too is a breaking change this is not a 1.0 release and the release is short-lived as of right now.
This change introduces a new method, StartContext, which should achieve the goals from the last change, but retain backwards compatibility.
StartContext is a blocking call like Start is, but allows for a context to be passed in, thus allowing for cancellation.