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
aa98d987a7.

Since it's a non-integer comparison, the change shouldn't have any
observable effect in normal operation.
This commit is contained in:
David Macek 2021-04-24 19:48:05 +02:00 committed by Valentin Lorentz
parent dce969e4b9
commit 151fcf8caf

View File

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