Skip to content

Commit d6ade67

Browse files
committed
fixed issue with not submitting tasks to asyncio.wait. Fixes #35
1 parent d768f58 commit d6ade67

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

python_utils/generators.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
async def abatcher(
9-
generator: types.AsyncGenerator,
9+
generator: types.AsyncIterator,
1010
batch_size: types.Optional[int] = None,
1111
interval: types.Optional[types.delta_type] = None,
1212
):
@@ -33,7 +33,10 @@ async def abatcher(
3333
while True:
3434
try:
3535
done, pending = await asyncio.wait(
36-
pending or [generator.__anext__()],
36+
pending
37+
or [
38+
asyncio.create_task(generator.__anext__()), # type: ignore
39+
],
3740
timeout=interval_s,
3841
return_when=asyncio.FIRST_COMPLETED,
3942
)

0 commit comments

Comments
 (0)