Add 429 logging
This commit is contained in:
parent
37b58a5a7e
commit
282ce8b0e9
3 changed files with 2 additions and 3 deletions
|
@ -103,6 +103,7 @@ template fetchImpl(result, fetchBody) {.dirty.} =
|
||||||
setLimited(account, api)
|
setLimited(account, api)
|
||||||
raise rateLimitError()
|
raise rateLimitError()
|
||||||
elif result.startsWith("429 Too Many Requests"):
|
elif result.startsWith("429 Too Many Requests"):
|
||||||
|
echo "[accounts] 429 error, API: ", api, ", account: ", account.id
|
||||||
account.apis[api].remaining = 0
|
account.apis[api].remaining = 0
|
||||||
# rate limit hit, resets after the 15 minute window
|
# rate limit hit, resets after the 15 minute window
|
||||||
raise rateLimitError()
|
raise rateLimitError()
|
||||||
|
|
|
@ -109,7 +109,7 @@ proc invalidate*(account: var GuestAccount) =
|
||||||
if idx > -1: accountPool.delete(idx)
|
if idx > -1: accountPool.delete(idx)
|
||||||
account = nil
|
account = nil
|
||||||
|
|
||||||
proc release*(account: GuestAccount; invalid=false) =
|
proc release*(account: GuestAccount) =
|
||||||
if account.isNil: return
|
if account.isNil: return
|
||||||
dec account.pending
|
dec account.pending
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,6 @@ type
|
||||||
id*: string
|
id*: string
|
||||||
oauthToken*: string
|
oauthToken*: string
|
||||||
oauthSecret*: string
|
oauthSecret*: string
|
||||||
# init*: Time
|
|
||||||
lastUse*: Time
|
|
||||||
pending*: int
|
pending*: int
|
||||||
apis*: Table[Api, RateLimit]
|
apis*: Table[Api, RateLimit]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue