Tweak idle delays for better performance

This commit is contained in:
Andrew Godwin 2016-02-23 22:17:24 +00:00
parent fff69f64a7
commit eaa762c9e3

View File

@ -27,14 +27,14 @@ class Server(object):
Run in a separate thread; reads messages from the backend. Run in a separate thread; reads messages from the backend.
""" """
channels = self.factory.reply_channels() channels = self.factory.reply_channels()
delay = 0.3 delay = 0.05
# Quit if reactor is stopping # Quit if reactor is stopping
if not reactor.running: if not reactor.running:
logging.debug("Backend reader quitting due to reactor stop") logging.debug("Backend reader quitting due to reactor stop")
return return
# 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.05 delay = 0.01
channel, message = self.channel_layer.receive_many(channels, block=False) channel, message = self.channel_layer.receive_many(channels, block=False)
if channel: if channel:
delay = 0 delay = 0