Skip to content

Commit

Permalink
chore: black .
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and BobTheBuidler committed Jan 6, 2025
1 parent 9e95627 commit cf601a8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions a_sync/utils/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
_logger_log = logger._log


async def exhaust_iterator(
iterator: AsyncIterator[T], *, queue: Optional[Queue] = None
) -> None:
async def exhaust_iterator(iterator: AsyncIterator[T], *, queue: Optional[Queue] = None) -> None:
"""
Asynchronously iterates over items from the given async iterator and optionally places them into a queue.
Expand All @@ -42,13 +40,13 @@ async def exhaust_iterator(
- :func:`as_yielded`
"""
done = 0

async def unblock_loop():
nonlocal done
done += 1
if done % 1000 == 0:
await sleep(0)

if queue is None:
async for thing in iterator:
await unblock_loop()
Expand Down

0 comments on commit cf601a8

Please sign in to comment.