I'm getting started with Channels 2.x. In my web app, certain actions take more than 30 seconds to complete, so rather than doing it synchronously in the request, we do the processing in the background. It seems that any background task requires ChannelNameRouter and a separate runworker process. But I am wondering if it's possible to do it in the same process, because:
- Background tasks are only run occasionally, so most of the time runworker will be idle and consuming RAM on resource-constrained servers. - Many people use my webapp with runserver, and I want to use the in-memory channel layer rather than requiring them to install Redis I am thinking of an option like this: (a) Start a channels.worker.Worker in a thread, like previous versions of Channels did in runserver. When I tried this I got an error about running event loops inside a thread (I cannot locate the error message at the moment). (b) Instantiate the background task's consumer as a singleton in the daphne process and send messages to its channel name, so it works like any other consumer. Any ideas? -- 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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. 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/02243277-c17d-48c7-90cf-74f9096638dd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.