Skip to content

Commit 5b9b8fe

Browse files
authored
core[patch]: Ignore ASYNC110 to upgrade to newest ruff version (langchain-ai#27229)
Ignoring ASYNC110 with explanation
1 parent 7da2efd commit 5b9b8fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libs/core/langchain_core/rate_limiters.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,13 @@ async def aacquire(self, *, blocking: bool = True) -> bool:
249249
return self._consume()
250250

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

255261

0 commit comments

Comments
 (0)