Re: Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-23 Thread Andrew Godwin
I'm not sure why that would happen - the code that chooses what application instance to use is here: https://github.com/django/asgiref/blob/master/asgiref/server.py (under get_or_create_application_instance). If you're always using a single channel name, which gets passed as scope_id (see here: ht

Re: Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-22 Thread itsnate_b
I am only using one channel name and my expectation is that only one instance of the background worker class should be initiated/used. Instead, I am seeing a new class being initiated for each call routed to the background worker class. This is unexpected... On Thursday, June 21, 2018 at 3:55:

Re: Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-21 Thread Andrew Godwin
The worker server tries to keep one application instance open per incoming channel name, but that's no guarantee. It will always make a new instance for different channel names. What kind of behaviour are you expecting? Andrew On Tue, Jun 19, 2018 at 6:45 AM itsnate_b wrote: > I am using Django

Django Channels 2.0 - How to init and persist/communicate with only one instance of background worker for every channel_layer.send?

2018-06-19 Thread itsnate_b
I am using Django 2.0.5, Python 3.6.2, Django Channels 2.1.1, aiohttp 3.1.3. I have created a background worker class which is initialized on a route to the appropriate event/function. Problem is that it initializes a *new* instance of the class on every triggered call, meaning that I cannot acc