mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-15 12:36:29 +00:00
Unify some guest account logs
This commit is contained in:
parent
51714b5ad2
commit
c3d9441370
2 changed files with 2 additions and 2 deletions
|
@ -138,7 +138,7 @@ proc fetch*(url: Uri; api: Api): Future[JsonNode] {.async.} =
|
||||||
elif errors in {rateLimited}:
|
elif errors in {rateLimited}:
|
||||||
account.apis[api].limited = true
|
account.apis[api].limited = true
|
||||||
account.apis[api].limitedAt = epochTime().int
|
account.apis[api].limitedAt = epochTime().int
|
||||||
echo "rate limited, api: ", $api, ", reqs left: ", account.apis[api].remaining, ", id: ", account.id
|
echo "[accounts] rate limited, api: ", api, ", reqs left: ", account.apis[api].remaining, ", id: ", account.id
|
||||||
|
|
||||||
proc fetchRaw*(url: Uri; api: Api): Future[string] {.async.} =
|
proc fetchRaw*(url: Uri; api: Api): Future[string] {.async.} =
|
||||||
fetchImpl result:
|
fetchImpl result:
|
||||||
|
|
|
@ -77,7 +77,7 @@ proc isLimited(account: GuestAccount; api: Api): bool =
|
||||||
|
|
||||||
if limit.limited and (epochTime().int - limit.limitedAt) > dayInSeconds:
|
if limit.limited and (epochTime().int - limit.limitedAt) > dayInSeconds:
|
||||||
account.apis[api].limited = false
|
account.apis[api].limited = false
|
||||||
echo "account limit reset, api: ", api, ", id: ", account.id
|
log "resetting limit, api: ", api, ", id: ", account.id
|
||||||
|
|
||||||
return limit.limited or (limit.remaining <= 10 and limit.reset > epochTime().int)
|
return limit.limited or (limit.remaining <= 10 and limit.reset > epochTime().int)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue