We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
asyncio.wait
1 parent d768f58 commit d6ade67Copy full SHA for d6ade67
1 file changed
python_utils/generators.py
@@ -6,7 +6,7 @@
6
7
8
async def abatcher(
9
- generator: types.AsyncGenerator,
+ generator: types.AsyncIterator,
10
batch_size: types.Optional[int] = None,
11
interval: types.Optional[types.delta_type] = None,
12
):
@@ -33,7 +33,10 @@ async def abatcher(
33
while True:
34
try:
35
done, pending = await asyncio.wait(
36
- pending or [generator.__anext__()],
+ pending
37
+ or [
38
+ asyncio.create_task(generator.__anext__()), # type: ignore
39
+ ],
40
timeout=interval_s,
41
return_when=asyncio.FIRST_COMPLETED,
42
)
0 commit comments