Skip to content

Commit

Permalink
cacheload: use ticker instead of after (#7729)
Browse files Browse the repository at this point in the history
<!-- Optional: Provide additional context (beyond the PR title). -->

<!-- Optional: link a GitHub issue.
Example: "Fixes #123" will auto-close #123 when the PR is merged. -->

**Related issues**: N/A
cacheload in raft-dev got fatal error "too many concurrent timer
firings"
  • Loading branch information
luluz66 authored Oct 11, 2024
1 parent 95130b4 commit 926c9b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/cacheload/cacheload.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,12 @@ func main() {

// Periodically print read and write QPS.
eg.Go(func() error {
ticker := time.NewTicker(time.Second)
for {
select {
case <-gctx.Done():
return nil
case <-time.After(time.Second):
case <-ticker.C:
log.Printf("Write: %.1f, Read: %.1f QPS (%s avg)", writeQPSCounter.Get(), readQPSCounter.Get(), *qpsAvgWindow)
}
}
Expand Down

0 comments on commit 926c9b7

Please sign in to comment.