mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-04-21 04:35:19 +00:00
Fix event loop is closed in Celery workers
This commit is contained in:
@@ -22,6 +22,8 @@ def asynctask(f):
|
|||||||
await database.disconnect()
|
await database.disconnect()
|
||||||
|
|
||||||
coro = run_with_db()
|
coro = run_with_db()
|
||||||
|
if current_task:
|
||||||
|
return asyncio.run(coro)
|
||||||
try:
|
try:
|
||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user