Closed ric-evans closed 3 years ago
Inside an async test (so it already started a loop and is an async function) you called db_utils.MoUMotorClient(mock_mongo)
, which is a sync function that calls run_until_complete
. So that's async -> sync -> async, which is a no-no.
Found it. WIPACrepo/mou-dashboard@
0900f12
/tests/unit/test_rest_server.py#L243Inside an async test (so it already started a loop and is an async function) you called
db_utils.MoUMotorClient(mock_mongo)
, which is a sync function that callsrun_until_complete
. So that's async -> sync -> async, which is a no-no.
Good catch. I'm surprised this issue didn't come up for previous releases. Perhaps it was skipping the test, instead of failing.
In a branch of https://github.com/WIPACrepo/mou-dashboard, on a call to
asyncio.get_event_loop().run_until_complete
, OTEL seems to be the cause of an error (RuntimeError: This event loop is already running
).@dsschult: "another call to
asyncio.run
orloop.run_until_complete
somewhere. and you can't have two of them"There doesn't seem to be any of these calls. Further investigation is needed. It could be a consequence of spanning over the
RestHandler
's async_execute()
method.Example: https://app.circleci.com/pipelines/github/WIPACrepo/mou-dashboard/252/workflows/27d162fe-ce0b-48a0-a262-5d68c4f5cab7/jobs/554, the second-to-last command, line 1904