From 151fcf8caf6e800b1035441e5861c659fce7cc9c Mon Sep 17 00:00:00 2001 From: David Macek Date: Sat, 24 Apr 2021 19:48:05 +0200 Subject: [PATCH] Don't throttle when delay is exactly equal If throttle time is set to 0.0 (e.g. in tests) and the reported time since last dequeue is also 0.0 (maybe because the timer resolution is too low), takeMsg would throttle. This would make tests fail because they expect messages immediately. This issue was observed on Windows 10 20H2 with both a mingw-w64 Python v3.8.9 from MSYS2 and several version of official Python v3.x. Confirmed at least as far back as aa98d987a7f4db6e57b5b8489ca714d98c6b8452. Since it's a non-integer comparison, the change shouldn't have any observable effect in normal operation. --- src/irclib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/irclib.py b/src/irclib.py index b24c5dbdf..f4bb6cce7 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -1430,7 +1430,7 @@ class Irc(IrcCommandDispatcher, log.Firewalled): if self.fastqueue: msg = self.fastqueue.dequeue() elif self.queue: - if now-self.lastTake <= conf.supybot.protocols.irc.throttleTime(): + if now-self.lastTake < conf.supybot.protocols.irc.throttleTime(): log.debug('Irc.takeMsg throttling.') else: self.lastTake = now