3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

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.
This commit is contained in:
James Lu 2017-05-07 17:31:31 -07:00
parent ce77f2cbd4
commit 62aea23879

View File

@ -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):