- Notifications
You must be signed in to change notification settings - Fork1.1k
fix(agent/agentcontainers): remove unneeded default branch#20511
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Closescoder/internal#769According to the `time.NewTicker` documentation [^1] (which is used under thehood byhttps://github.com/coder/quartz) it will automatically adjustthe time interval to make up for slow receivers. This means we should besafe to drop the default branch.> NewTicker returns a new Ticker containing a channel that will send the current time on the channel after each tick. The period of the ticks is specified by the duration argument. The ticker will adjust the time interval or drop ticks to make up for slow receivers. The duration d must be greater than zero; if not, NewTicker will panic.[^1]:https://pkg.go.dev/time#Ticker
johnstcn left a comment
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.
LGTM but will defer to@mafredri
mafredri commentedOct 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@DanielleMaywood Please re-check the Go docs for the Go version we use, IIRC the implementation changed recently. IIRC the reason for the default case is not slow receivers, it's to not queue up a periodic update if a one is already running. Allowing it should be fine though, perhaps just a bit wasteful. By what mechanism are you proposing that removing the default case fixes the flake? |
DanielleMaywood commentedOct 28, 2025
@mafredri Docs for version of go we use says the same thinghttps://pkg.go.dev/time@go1.24.2#NewTicker I've tested locally and this fix does appear to stop the flake happening for me. As for why, I'massuming in the test scenario there is a race on the My understanding could be entirely wrong though (although I haven't managed to get the error to occur again with the change). |
mafredri commentedOct 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
IMO a better option would be to make On second thought, I overlooked one thing with dropping default so that approach is not any worse than buffering the trigger. |
e4e4669 intomainUh oh!
There was an error while loading.Please reload this page.
Closescoder/internal#769
According to the
time.NewTickerdocumentation1 (which is used under the hood byhttps://github.com/coder/quartz) it will automatically adjust the time interval to make up for slow receivers. This means we should be safe to drop the default branch.Footnotes
https://pkg.go.dev/time#Ticker↩