From 5be37737eb43902fc1dc45c4862637c1d3fd3178 Mon Sep 17 00:00:00 2001 From: Zed Date: Wed, 12 Feb 2025 18:36:29 +0100 Subject: [PATCH] Fix rate limit handling --- src/auth.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/auth.nim b/src/auth.nim index c57008b..bf3c957 100644 --- a/src/auth.nim +++ b/src/auth.nim @@ -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]