微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何从Django Channels连接限制中恢复?

如何解决如何从Django Channels连接限制中恢复?

我在heroku上运行服务器,在asyncConsumers实例之间进行断续的通道层通信。在本地运行heroku时,redis通道连接没有问题,因为我可以根据需要拥有任意数量的通道,但是将服务器上载到heroku后,它给了我20个redis连接限制。如果我使用了更多的服务器错误,那么我会尝试减少到​​期时间,以便关闭非活动的Redis连接。但是,如果redis连接过期,并且我尝试将通道名称与self.channel_layer.send()一起使用,则会收到以下错误,如何从此错误中恢复,而不必通过外部调用来创建另一个asyncConsumer实例?

ERROR    Exception inside application: Reader at end of file
File "/app/.heroku/python/lib/python3.6/site-packages/channels/consumer.py",line 59,in __call__
[receive,self.channel_receive],self.dispatch
File "/app/.heroku/python/lib/python3.6/site-packages/channels/utils.py",line 51,in await_many_dispatch
await dispatch(result)
File "/app/.heroku/python/lib/python3.6/site-packages/channels/consumer.py",line 73,in dispatch
await handler(message)
File "./myapp/webhook.py",line 133,in HTTP_Request
await self.channel_layer.send(userDB.backEndChannelName,{"type": "device.query"})
File "/app/.heroku/python/lib/python3.6/site-packages/channels_redis/core.py",line 296,in send
if await connection.llen(channel_key) >= self.get_capacity(channel):
File "/app/.heroku/python/lib/python3.6/site-packages/aioredis/commands/list.py",line 70,in llen
return self.execute(b'LLEN',key)
File "/app/.heroku/python/lib/python3.6/site-packages/aioredis/commands/__init__.py",in execute
return self._pool_or_conn.execute(command,*args,**kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/aioredis/connection.py",line 322,in execute
raise ConnectionClosedError(msg)
Reader at end of file

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。