asgiref: v3.4.x get_running_loop break django-channels runworker

get_running_loop raise RuntimeError with any django-channels runworker command because there is no running event loop…

patch?

diff --git a/asgiref/server.py b/asgiref/server.py
index fb1c394..d1d27f4 100644
--- a/asgiref/server.py
+++ b/asgiref/server.py
@@ -56,8 +56,8 @@ class StatelessServer:
         """
         Runs the asyncio event loop with our handler loop.
         """
-        event_loop = get_running_loop()
-        asyncio.ensure_future(self.application_checker())
+        event_loop = asyncio.get_event_loop()
+        asyncio.ensure_future(self.application_checker(), loop=event_loop)
         try:
             event_loop.run_until_complete(self.handle())
         except KeyboardInterrupt:

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15 (11 by maintainers)

Most upvoted comments

I have the same problem in https://github.com/django/channels/issues/1713.

Tested with python 3.8.4 and python 3.10.0 (3.10.0a5)

no problems when asgiref==3.3.4 is installed

@bj00rn no. Let’s close it here though it’s a channels issue.