Hi John, This is fixed in the asgiref master branch, I should be releasing it soon.
Andrew On Sat, Feb 3, 2018 at 4:14 PM, John Wayne <[email protected]> wrote: > Hi everyone, > > I am trying to send a channels message from a django signal. The problem > ist that the signal function is not async. So I tried to use the > AsyncToSync wrapper. > But it seems this is not possible as the signal handler is run by a thread > and has no event loop. > > ... > self.main_event_loop = asyncio.get_event_loop() > File "/usr/lib/python3.5/asyncio/events.py", line 632, in get_event_loop > return get_event_loop_policy().get_event_loop() > File "/usr/lib/python3.5/asyncio/events.py", line 578, in get_event_loop > % threading.current_thread().name) > RuntimeError: There is no current event loop in thread 'Thread-2'. > > So I tried to create the AsyncToSync inside the app.py as this gets > executed by the main thread. By passing this instance I tried to execute > the wrapper inside > the signal handler. But this also doesn't work and the website is stuck > loading. How can I get around this issue? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/ddda3ff6-79f9-43b8-a201-5792512564d7%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/ddda3ff6-79f9-43b8-a201-5792512564d7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1uq-KRfJs6ZOcp_rF86tS1RzBOz4-t2voydpZsM6ExdYng%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

