Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-822

Python running loop inefficiency with motor

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Unknown 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.

            Assignee:
            julius.park@mongodb.com Julius Park (Inactive)
            Reporter:
            maulberto3@hotmail.com Mauricio Maroto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: