mirror of
https://github.com/django/daphne.git
synced 2024-11-22 07:56:34 +03:00
Merge pull request #47 from Krukov/fix-285-channels-issue
Catching error at receive_many form channel layer
This commit is contained in:
commit
6df13290b2
|
@ -94,7 +94,12 @@ class Server(object):
|
||||||
# Don't do anything if there's no channels to listen on
|
# Don't do anything if there's no channels to listen on
|
||||||
if channels:
|
if channels:
|
||||||
delay = 0.01
|
delay = 0.01
|
||||||
|
try:
|
||||||
channel, message = self.channel_layer.receive_many(channels, block=False)
|
channel, message = self.channel_layer.receive_many(channels, block=False)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('Error at trying to receive messages: %s' % e)
|
||||||
|
delay = 5.00
|
||||||
|
else:
|
||||||
if channel:
|
if channel:
|
||||||
delay = 0.00
|
delay = 0.00
|
||||||
# Deal with the message
|
# Deal with the message
|
||||||
|
@ -116,7 +121,12 @@ class Server(object):
|
||||||
return
|
return
|
||||||
channels = self.factory.reply_channels()
|
channels = self.factory.reply_channels()
|
||||||
if channels:
|
if channels:
|
||||||
|
try:
|
||||||
channel, message = yield self.channel_layer.receive_many_twisted(channels)
|
channel, message = yield self.channel_layer.receive_many_twisted(channels)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('Error at trying to receive messages: %s' % e)
|
||||||
|
yield self.sleep(5.00)
|
||||||
|
else:
|
||||||
# Deal with the message
|
# Deal with the message
|
||||||
if channel:
|
if channel:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user