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

don't use the time value from the time.Ticker channel #2127

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

MarcoPolo
Copy link
Collaborator

Generally doing something like now := <-ticker.C is wrong. The time in the channel is the time when the ticker was triggered, but may not be the current time when you pull from the channel. In a fast runtime these two are pretty close. In a slow runtime they aren't. This becomes a problem when we drop tick events, so the receiver will only get the old event and not the new one, thus breaking the logic that relies on the current time.

Changes this to make an explicit call to get the current time.

@marten-seemann marten-seemann changed the title Fix incorrect usages of ticker don't use the time value from the time.Ticker channel Feb 22, 2023
@marten-seemann marten-seemann merged commit 6406324 into master Feb 23, 2023
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