You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue when using Redis with Django Channels, where the connection crashes. Below are the details of my setup and an example of the code that's causing the issue:
Environment:
Python version: 3.11.7
Django version: 5.0.3
Channels version: 4.1.0
Channels Redis version: 4.2.0
Redis version: 5.4.0
Operating System: Ubuntu 20.04
Code Example:
fromchannels.generic.websocketimportAsyncWebsocketConsumerclassChatConsumer(AsyncWebsocketConsumer):
channel_layer_alias="chat"asyncdefconnect(self):
user=self.scope["user"]
ifuser.is_authenticated:
# Accept the connectionawaitself.accept()
# Add the channel to a group with the current user's idawaitself.channel_layer.group_add(str(user.id), self.channel_name)
on_websocket_connect_task.apply_async(
kwargs=dict(channel_name=self.channel_name, user_id=str(user.id)),
queue=settings.QUEUE_CHAT,
)
else:
self.close(code=1000)
Error:
The connection crashes in redis/asyncio/connection.py. Here is the traceback:
This error occurs repeatedly when the socket remains inactive for hours. It happens not only in the chat application but also in others. To connect to a socket, we have to attempt to connect up to 3 times.
The text was updated successfully, but these errors were encountered:
I'm encountering an issue when using Redis with Django Channels, where the connection crashes. Below are the details of my setup and an example of the code that's causing the issue:
Environment:
Code Example:
Error:
The connection crashes in
redis/asyncio/connection.py
. Here is the traceback:This error occurs repeatedly when the socket remains inactive for hours. It happens not only in the chat application but also in others. To connect to a socket, we have to attempt to connect up to 3 times.
The text was updated successfully, but these errors were encountered: