From 929859b2461c14443c6877d904220970ed871bb7 Mon Sep 17 00:00:00 2001 From: James Vega Date: Fri, 18 Jun 2010 20:33:43 -0400 Subject: [PATCH] Twisted: Send all available ircmsgs and reduce delay between checks All ircmsgs that takeMsg will return should be processed each time checkIrcForMsgs is called since there may be multiple available in the fastqueue. Reduced the time between calls of checkIrcForMsgs so the delay between normally queued ircmsgs stays close to the configured throttleTime. Closes: Sf#3018148 (cherry picked from commit adc5d62bbf6b89631ab25e9b5f5707bde0b06709) Signed-off-by: Daniel Folkinshteyn --- src/drivers/Twisted.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/drivers/Twisted.py b/src/drivers/Twisted.py index 7b41b7c4f..c91d80d6b 100644 --- a/src/drivers/Twisted.py +++ b/src/drivers/Twisted.py @@ -66,7 +66,7 @@ class SupyIrcProtocol(LineReceiver): delimiter = '\n' MAX_LENGTH = 1024 def __init__(self): - self.mostRecentCall = reactor.callLater(1, self.checkIrcForMsgs) + self.mostRecentCall = reactor.callLater(0.1, self.checkIrcForMsgs) def lineReceived(self, line): msg = drivers.parseMsg(line) @@ -76,9 +76,10 @@ class SupyIrcProtocol(LineReceiver): def checkIrcForMsgs(self): if self.connected: msg = self.irc.takeMsg() - if msg: + while msg: self.transport.write(str(msg)) - self.mostRecentCall = reactor.callLater(1, self.checkIrcForMsgs) + msg = self.irc.takeMsg() + self.mostRecentCall = reactor.callLater(0.1, self.checkIrcForMsgs) def connectionLost(self, r): self.mostRecentCall.cancel()