From 62aea23879f61d82522bfb91c0eb4fd9d3059740 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 7 May 2017 17:31:31 -0700 Subject: [PATCH] Irc: fix throttle_time not actually blocking for the defined amount of time Passing the timeout to queue.Queue.get is invalid because it'll only block if there ISN'T any text to send. --- classes.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/classes.py b/classes.py index 257a18b..d8cc9b4 100644 --- a/classes.py +++ b/classes.py @@ -176,11 +176,15 @@ class Irc(utils.DeprecatedAttributesObject): def processQueue(self): """Loop to process outgoing queue data.""" - while not self.aborted.is_set(): + while True: throttle_time = self.serverdata.get('throttle_time', 0.005) - data = self.queue.get(throttle_time) - if data: - self._send(data) + if not self.aborted.wait(throttle_time): + try: + data = self.queue.get_nowait() + self._send(data) + except Queue.Empty: + pass + log.debug('(%s) Stopping queue thread as aborted is set', self.name) def connect(self):