Channels: event loop and thread

36 views
Skip to first unread message

Zhiyu (Drew) Li

unread,
Nov 6, 2018, 7:42:16 AM11/6/18
to django...@googlegroups.com
Hi there,

I got the following 2 questions 

There is only one thread (MainThread) and one event loop running on it by default if all existing consumers are asynchronous consumers?

Regular sync views (if any) are handled by Threadpoolexecutor and run in a sub Thread. These sync views won't block the event loop in the main thread. Channels takes care of this subthread and I don't need to explicitly manage it. Right?

Thanks
Drew


Andrew Godwin

unread,
Nov 6, 2018, 11:48:52 AM11/6/18
to django...@googlegroups.com
Your assumptions are correct. The only extra thing to be aware of is that some Django interactions (like the Channels Auth middleware) need to do database connections and thus have to launch into a subthread for that, but that's also managed.

Andrew

--
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...@googlegroups.com.
To post to this group, send email to django...@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/CAMmsbUkjbuRvYjoZDyDY%3DXkaoQJHHiG659XKX-tPCbe7HqgivA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages