Skip to content

Commit

Permalink
Close an asyncio event loop in the test suite (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtmckee authored Jun 25, 2024
1 parent 5ed539c commit 5bc361b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dramatiq/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def stop(self):
if self.loop.is_running():
self.logger.info("Stopping event loop...")
self.loop.call_soon_threadsafe(self.loop.stop)
self.join()
self.loop.close()

def run_coroutine(self, coro: Awaitable[R]) -> R:
"""Runs the given coroutine on the event loop.
Expand Down
1 change: 0 additions & 1 deletion tests/middleware/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def started_thread():
set_event_loop_thread(thread)
yield thread
thread.stop()
thread.join()
set_event_loop_thread(None)


Expand Down

0 comments on commit 5bc361b

Please sign in to comment.