Reputation: 1
I have a django channels projeto to handle a websocket connections, but some http request are blocking the app, and im receiving this error:
Application instance <Task pending name='Task-3739' coro=<ProtocolTypeRouter.call() running at /usr/local/lib/python3.10/site-packages/channels/routing.py:62> wait_for=<Future pending cb=[shield.._outer_done_callback() at /usr/local/lib/python3.10/asyncio/tasks.py:864, Task.task_wakeup()]>> for connection <WebRequest at 0x7efc603c8250 method=POST uri=/charger_api/heartbeat/ clientproto=HTTP/1.1> took too long to shut down and was killed.
the entire comsumer are async and the rest part of django app is sync
this is my Comsumer
class ChargerSessionConsumer(AsyncJsonWebsocketConsumer):
def __init__(self, *args, **kwargs):
super().__init__(args, kwargs)
self.client_id = None
self.group_name = None
async def connect(self):
self.client_id = self.scope["url_route"]["kwargs"]["client_id"]
await self.channel_layer.group_add(
self.group_name, self.channel_name
)
await self.accept()
async def disconnect(self, close_code):
await self.channel_layer.group_discard(self.group_name, self.channel_name)
raise StopConsumer()
I try to raise to raise the stodComsumer ocording the documentation but the error percists
Upvotes: 0
Views: 144