diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-08 09:34:32 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-08 09:34:32 +0200 |
| commit | f7f98ccaffc1be88db6f9814fb3c88b5f0a6ea34 (patch) | |
| tree | b16c9be77e4d4f9e2fedba83b356e6abf21b6d0e /internal/clients/stats.go | |
| parent | 7179dba1f70f7fbdc8b89bf709bc2d5b643fe692 (diff) | |
task: replace looped time.After with tickers (task 378)
Diffstat (limited to 'internal/clients/stats.go')
| -rw-r--r-- | internal/clients/stats.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/clients/stats.go b/internal/clients/stats.go index 7a6643b..5880fd1 100644 --- a/internal/clients/stats.go +++ b/internal/clients/stats.go @@ -39,6 +39,9 @@ func newTailStats(servers int) *stats { func (s *stats) Start(ctx context.Context, throttleCh <-chan struct{}, statsCh <-chan string, quiet bool) { + ticker := time.NewTicker(3 * time.Second) + defer ticker.Stop() + var connectedLast int for { var force bool @@ -48,7 +51,7 @@ func (s *stats) Start(ctx context.Context, throttleCh <-chan struct{}, case message := <-statsCh: messages = append(messages, message) force = true - case <-time.After(time.Second * 3): + case <-ticker.C: case <-ctx.Done(): return } |
