More aggressive token strategy to combat bursts

This commit is contained in:
Zed 2020-06-01 13:54:45 +02:00
parent baa28ea8bc
commit 2642e5efe4
1 changed files with 2 additions and 2 deletions

View File

@ -58,5 +58,5 @@ proc poolTokens*(amount: int) {.async.} =
proc initTokenPool*(cfg: Config) {.async.} = proc initTokenPool*(cfg: Config) {.async.} =
while true: while true:
if tokenPool.countIt(not it.isLimited) < cfg.minTokens: if tokenPool.countIt(not it.isLimited) < cfg.minTokens:
await poolTokens(min(3, cfg.minTokens - tokenPool.len)) await poolTokens(min(4, cfg.minTokens - tokenPool.len))
await sleepAsync(4000) await sleepAsync(2000)