We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
append_record_batches
1 parent 043be93 commit 70ce203Copy full SHA for 70ce203
1 file changed
src/s2_sdk/_batching.py
@@ -64,9 +64,17 @@ async def append_record_batches(
64
continue
65
66
try:
67
+ deadline = (
68
+ asyncio.get_event_loop().time() + linger_secs
69
+ if linger_secs > 0
70
+ else None
71
+ )
72
while not acc.is_full():
- if linger_secs > 0:
- record = await asyncio.wait_for(anext(aiter), timeout=linger_secs)
73
+ if deadline is not None:
74
+ remaining = deadline - asyncio.get_event_loop().time()
75
+ if remaining <= 0:
76
+ break
77
+ record = await asyncio.wait_for(anext(aiter), timeout=remaining)
78
else:
79
record = await anext(aiter)
80
acc.add(record)
0 commit comments