Django WebSockets Exception during Stress Testing

Hello,

My company has been working on a Django Server that handles Web Socket connections for IOT devices. We recently made a large refactor to our Consumer class, migrating the Consumer from being syncronous to asyncronous with database logic moved out to workers. We started stress testing the server and when under load, all of our websocket connections get terminated and this warning shows up in the console:

**2026-02-25 08:14:21,836 WARNING Application instance <Task pending name=‘Task-39679’ coro=<ProtocolTypeRouter._call_() running at /usr/local/lib/python3.11/site-packages/channels/routing.py:48> wait_for=<Future pending cb=[shield.._outer_done_callback() at /usr/local/lib/python3.11/asyncio/tasks.py:908, Task.task_wakeup()]>> for connection <WebSocketProtocol client=[‘10.116.0.9’, 62814] path=b’/hubs/'> took too long to shut down and was killed.
**
I’ve been trying to look into this but at this point I’m stuck. Is there anywhere I should look in the server code to try and remedy this?