More aggressive token strategy to combat bursts
This commit is contained in:
		
							parent
							
								
									baa28ea8bc
								
							
						
					
					
						commit
						2642e5efe4
					
				| 
						 | 
				
			
			@ -58,5 +58,5 @@ proc poolTokens*(amount: int) {.async.} =
 | 
			
		|||
proc initTokenPool*(cfg: Config) {.async.} =
 | 
			
		||||
  while true:
 | 
			
		||||
    if tokenPool.countIt(not it.isLimited) < cfg.minTokens:
 | 
			
		||||
      await poolTokens(min(3, cfg.minTokens - tokenPool.len))
 | 
			
		||||
    await sleepAsync(4000)
 | 
			
		||||
      await poolTokens(min(4, cfg.minTokens - tokenPool.len))
 | 
			
		||||
    await sleepAsync(2000)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue