Filter out account limits that already reset
This commit is contained in:
		
							parent
							
								
									3572dd7771
								
							
						
					
					
						commit
						bbd68e6840
					
				| 
						 | 
					@ -19,6 +19,8 @@ proc getPoolJson*(): JsonNode =
 | 
				
			||||||
    totalPending = 0
 | 
					    totalPending = 0
 | 
				
			||||||
    reqsPerApi: Table[string, int]
 | 
					    reqsPerApi: Table[string, int]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  let now = epochTime()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for account in accountPool:
 | 
					  for account in accountPool:
 | 
				
			||||||
    totalPending.inc(account.pending)
 | 
					    totalPending.inc(account.pending)
 | 
				
			||||||
    list[account.id] = %*{
 | 
					    list[account.id] = %*{
 | 
				
			||||||
| 
						 | 
					@ -27,6 +29,9 @@ proc getPoolJson*(): JsonNode =
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for api in account.apis.keys:
 | 
					    for api in account.apis.keys:
 | 
				
			||||||
 | 
					      if (now.int - account.apis[api].reset) / 60 > 15:
 | 
				
			||||||
 | 
					        continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      list[account.id]["apis"][$api] = %account.apis[api].remaining
 | 
					      list[account.id]["apis"][$api] = %account.apis[api].remaining
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let
 | 
					      let
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue