Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-19 Thread itsnate_b
I managed to resolve the cascading crash issue by doing some more asyncio reading and using: self.t1 = asyncio.run_coroutine_threadsafe(self.listen(), loop=loop) instead of: t1 = asyncio.ensure_future(self.listen(), loop=loop) await t1 This makes it run concurrently with the main asyncio

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread itsnate_b
I am unable to determine the cause of the handler issue (assuming something is crashing the channels websocket?). Could this be a redis queue issue? Where events being passed through the channel layer are filling up a queue and not being flushed correctly? I have no idea where to go from

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread itsnate_b
Further to the message above - I moved everything into the consumers.py file and routed to the class inside of there. Still getting this error AFTER I get the print statement print('awaiting t1') I have confirmed that this occurs after this runs successfully: background worker sends a message

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread itsnate_b
Further to the message above - I moved everything into the consumers.py file and routed to the class inside of there. Still getting this error AFTER I get the print statement print('awaiting t1') I have confirmed that this occurs after this runs successfully: background worker sends a message

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-18 Thread Nathan Bluvol
Hi Andrew, Thank you for your quick reply. I use AsyncConsumer in the background worker because it seems to route properly (i.e. without error). If I create a new class, then I run into scope issues or simply a TypeError where the 'backgroundConsumer object is not callable'. *The reason for all

Re: Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-17 Thread Andrew Godwin
I'm not quite sure why you seem to be using an AsyncConsumer outside of the context of the Channels routing framework? Anyway, it sounds like from what you're describing that your listen() method is blocking, which makes sense, as it connects to an external websocket and listens on it for

Django Channels 2.0 websocket crashing & blocking while using aiohttp

2018-06-17 Thread Nathan Bluvol
I am using Django 2.0.5, Python 3.6.2, Django Channels 2.1.1, aiohttp 3.1.3. Background: I am connecting to an external websocket, asynchronously, using aiohttp within a background channels worker. Once triggered, the socket connection stays alive, listening/streaming, and sends incoming