mirror of
https://github.com/zedeus/nitter.git
synced 2025-03-04 01:51:12 +00:00
Fix rate limit handling
This commit is contained in:
parent
7702576369
commit
5be37737eb
1 changed files with 3 additions and 2 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue