Skip to content

Commit

Permalink
core[patch]: Ignore ASYNC110 to upgrade to newest ruff version (langc…
Browse files Browse the repository at this point in the history
…hain-ai#27229)

Ignoring ASYNC110 with explanation
  • Loading branch information
eyurtsev authored Oct 9, 2024
1 parent 7da2efd commit 5b9b8fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libs/core/langchain_core/rate_limiters.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,13 @@ async def aacquire(self, *, blocking: bool = True) -> bool:
return self._consume()

while not self._consume():
await asyncio.sleep(self.check_every_n_seconds)
# This code ignores the ASYNC110 warning which is a false positive in this
# case.
# There is no external actor that can mark that the Event is done
# since the tokens are managed by the rate limiter itself.
# It needs to wake up to re-fill the tokens.
# https://docs.astral.sh/ruff/rules/async-busy-wait/
await asyncio.sleep(self.check_every_n_seconds) # ruff: noqa: ASYNC110
return True


Expand Down

0 comments on commit 5b9b8fe

Please sign in to comment.