-
Type: Task
-
Resolution: Gone away
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: asyncio
-
None
Basically, in a python environment i.e. uvicorn index:app, motor seems to be working fine. However, in an isolated docker, motor doesn't seem to get the correct running loop, therefore, when using motor, it errors out with task is attached to another loop exception. The loop= argument in the client constructor can't seem to resolve the issue. The hack is to do similar to this
db_client.get_io_loop = get_running_loop # HACK as motor seems to start some other loop
Regarding motor client, docs says that
io_loop (optional): Special event loop instance to use instead of default.
But, still, as said, inside docker, it creates another loop. Strange.