Skip to content

Commit 152d9c0

Browse files
committed
fix: fix batch processor
The change to BasePartialProcessor.async_process() in commit d08711f causes the method to create a new loop on every invocation. This is because asyncio.get_running_loop() raises RuntimeError also when the thread has an event loop, since the loop is no longer running after loop.run_until_complete() terminates.
1 parent 9e18800 commit 152d9c0

File tree

1 file changed

+1
-1
lines changed
  • aws_lambda_powertools/utilities/batch

1 file changed

+1
-1
lines changed

aws_lambda_powertools/utilities/batch/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async def async_process_closure():
135135
# Python 3.14+ will raise RuntimeError if get_event_loop() is called when there's no running loop
136136
# We need to handle both cases: existing loop (container reuse) and no loop (cold start)
137137
try:
138-
loop = asyncio.get_running_loop()
138+
loop = asyncio.get_event_loop()
139139
except RuntimeError:
140140
# No running loop, create a new one
141141
loop = asyncio.new_event_loop()

0 commit comments

Comments
 (0)