Filter out account limits that already reset

This commit is contained in:
Zed 2023-08-19 01:13:36 +02:00
parent 3572dd7771
commit bbd68e6840
1 changed files with 5 additions and 0 deletions

View File

@ -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