1
0
mirror of https://github.com/zedeus/nitter.git synced 2025-12-05 19:45:36 -05:00

Fix rate limit handling

This commit is contained in:
Zed
2025-02-12 18:36:29 +01:00
parent 7702576369
commit 5be37737eb

View File

@@ -5,7 +5,7 @@ import experimental/parser/session
# max requests at a time per session to avoid race conditions
const
maxConcurrentReqs = 3
maxConcurrentReqs = 2
dayInSeconds = 24 * 60 * 60
apiMaxReqs: Table[Api, int] = {
Api.search: 50,
@@ -130,8 +130,9 @@ proc isLimited(session: Session; api: Api): bool =
if (epochTime().int - session.limitedAt) > dayInSeconds:
session.limited = false
log "resetting limit: ", session.id
else:
return false
else:
return true
if api in session.apis:
let limit = session.apis[api]