Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lambda_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ def async_handler(handler):

@wraps(handler)
def wrapper(event, context):
context.loop = asyncio.get_event_loop()
try:
context.loop = asyncio.get_running_loop()
except RunTimeError:
context.loop = asyncio.new_event_loop()
return context.loop.run_until_complete(handler(event, context))

return wrapper
Expand Down