Skip to content

Commit

Permalink
feat: add sleep into rate_limit_inactive (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Dec 19, 2024
1 parent efac247 commit 9cd414c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dank_mids/helpers/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ async def rate_limit_inactive(endpoint: str) -> None:
await last_waiter
except CancelledError:
pass
# let recently popped waiters check the limiter for capacity, they might create new waiters
# then, let recently popped waiters make some calls to see if we're still being limited
for _ in range(10):
if waiters:
break
else:
await sleep(0)


_rate_limit_waiters.pop(endpoint).set()

Expand Down

0 comments on commit 9cd414c

Please sign in to comment.