Don't requests made before reset
This commit is contained in:
		
							parent
							
								
									209f453b79
								
							
						
					
					
						commit
						d17583286a
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								src/auth.nim
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/auth.nim
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -64,12 +64,16 @@ proc getAccountPoolHealth*(): JsonNode =
 | 
			
		|||
        apiStatus = account.apis[api]
 | 
			
		||||
        reqs = apiMaxReqs[api] - apiStatus.remaining
 | 
			
		||||
 | 
			
		||||
      reqsPerApi.mgetOrPut($api, 0).inc reqs
 | 
			
		||||
      totalReqs.inc reqs
 | 
			
		||||
 | 
			
		||||
      if apiStatus.limited:
 | 
			
		||||
        limited.incl account.id
 | 
			
		||||
 | 
			
		||||
      # no requests made with this account and endpoint since the limit reset
 | 
			
		||||
      if apiStatus.reset < now:
 | 
			
		||||
        continue
 | 
			
		||||
 | 
			
		||||
      reqsPerApi.mgetOrPut($api, 0).inc reqs
 | 
			
		||||
      totalReqs.inc reqs
 | 
			
		||||
 | 
			
		||||
  if accountPool.len > 0:
 | 
			
		||||
    average = average div accountPool.len
 | 
			
		||||
  else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue