Retry limited accounts after an hour

This commit is contained in:
Zed
2025-04-05 15:57:14 +01:00
parent 41fa47bfbf
commit 83b0f8b55a

View File

@@ -6,7 +6,7 @@ import experimental/parser/session
# max requests at a time per session to avoid race conditions # max requests at a time per session to avoid race conditions
const const
maxConcurrentReqs = 2 maxConcurrentReqs = 2
dayInSeconds = 24 * 60 * 60 hourInSeconds = 60 * 60
apiMaxReqs: Table[Api, int] = { apiMaxReqs: Table[Api, int] = {
Api.search: 50, Api.search: 50,
Api.tweetDetail: 500, Api.tweetDetail: 500,
@@ -127,7 +127,7 @@ proc isLimited(session: Session; api: Api): bool =
return true return true
if session.limited and api != Api.userTweets: if session.limited and api != Api.userTweets:
if (epochTime().int - session.limitedAt) > dayInSeconds: if (epochTime().int - session.limitedAt) > hourInSeconds:
session.limited = false session.limited = false
log "resetting limit: ", session.id log "resetting limit: ", session.id
return false return false