installed packages:
channels==2.1.3
asgiref==2.3.2
channelsmultiplexer==0.0.2
chanels-redis==2.3.0
django==2.0.8
from channels.layers import get_channel_layer
from asgiref.sync import async_to_sync as a2s
cl = get_channel_layer()
class Yyy:
def tt(self, z):
for x in range(0, z):
print(x)
a2s(cl.group_send)('group_name', {'type': 'group.method', 'content': 'data'})
y = Yyy()
y.tt(1000)
monitor on redis server clients count, it increases 1000 clients, waiting for a long time, connections still stay there
keep sending message outside consumer
finally, the redis server will raise MaxClients error