Skip to content
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

allow periodic flushes to Stop being emitted. #146

Merged
merged 3 commits into from
Dec 20, 2022
Merged

allow periodic flushes to Stop being emitted. #146

merged 3 commits into from
Dec 20, 2022

Conversation

tomwans
Copy link
Contributor

@tomwans tomwans commented Dec 19, 2022

This introduces a new Stop() method and changes the behavior of the Start() method on a store just slightly.

store.Start(), if called while a periodic flush goroutine is currently running, causes the existing goroutine to stop and be replaced with a new goroutine. That is, the caller can now change the rate of flushing with calls such as:

store.Start(time.NewTicker(1*time.Second))
store.Start(time.NewTicker(100*time.Second))

store.Stop() will stop any existing running periodic flush goroutine. If called multiple times, it is a no-op.

This introduces a new Stop() method and changes the behavior of the
Start() method on a store just slightly.

store.Start(), if called while a periodic flush goroutine is currently
running, causes the existing goroutine to stop and be replaced with a
new goroutine. That is, the caller can now change the rate of flushing
with calls such as:

store.Start(time.NewTicker(1*time.Second))
store.Start(time.NewTicker(100*time.Second))

store.Stop() will stop any existing running periodic flush
goroutine. If called multiple times, it is a no-op.
danielmmetz
danielmmetz previously approved these changes Dec 20, 2022
stats.go Outdated Show resolved Hide resolved
stats.go Outdated Show resolved Hide resolved
@tomwans tomwans merged commit f033a31 into master Dec 20, 2022
@tomwans tomwans deleted the stop branch December 20, 2022 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants