Commit 66083d0
authored
fix: avoid zero-rate queue reader throttling (#9619)
## Summary
- When `persistenceMaxQPS` is set to `0` (meaning "unlimited"), the
queue reader rate limiter receives a zero rate, causing all queue
readers to fail with "burst size is smaller than required token count"
and never process tasks.
- This fixes the rate function to return a high default (100,000) when
persistence QPS is unlimited, and adds a missing `return` after the
error log to prevent falling through to an invalid lock/read path.
## Bug Details
`NewHostRateLimiterRateFn` computes `float64(persistenceMaxRPS()) *
persistenceMaxRPSRatio`. When `persistenceMaxRPS()` returns 0
(unlimited), this produces rate=0, which creates a rate limiter with
burst=0. The reader then cannot acquire even 1 token, logging the error
but continuing into `r.Lock()` without tasks — effectively a tight error
loop.
## Testing
- Verified with benchmarks that queue readers function correctly with
`persistenceMaxQPS: 0` in dynamic config.
- Existing unit tests pass.1 parent bc0354e commit 66083d0
2 files changed
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
233 | 241 | | |
234 | 242 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| 434 | + | |
434 | 435 | | |
435 | 436 | | |
436 | 437 | | |
| |||
0 commit comments