79407658

Date: 2025-02-03 02:12:52
Score: 0.5
Natty:
Report link

Seem to find a solution.

asyncio.create_task is made for running coroutine in the same event loop as the main process. And await create_task(CatalogHandler.catalog_check(user.group_name, req.source, req.csv)) blocks process because it makes event loop wait for function execution.

What I changed:

And everything seems to work! Now I can execute a long-running process with websockets without blocking other API endpoints. Hope this is being useful. Will update this answer if I find anything interesting about the solution.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Lev Marder