diff --git a/libs/core/langchain_core/rate_limiters.py b/libs/core/langchain_core/rate_limiters.py index 043e54cc38f9b..11588020f6ba7 100644 --- a/libs/core/langchain_core/rate_limiters.py +++ b/libs/core/langchain_core/rate_limiters.py @@ -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