only .call() PollHooks when they're "due"

This commit is contained in:
jesopo 2019-10-10 14:12:58 +01:00
parent 1c792f0194
commit fd0baff093
2 changed files with 3 additions and 3 deletions

View file

@ -376,6 +376,7 @@ class Bot(object):
def _check(self): def _check(self):
for poll_timeout in self._poll_timeouts: for poll_timeout in self._poll_timeouts:
if poll_timeout.next() == 0:
poll_timeout.call() poll_timeout.call()
throttle_filled = False throttle_filled = False

View file

@ -32,7 +32,6 @@ class LockFile(PollHook.PollHook):
def next(self): def next(self):
return max(0, (self._next_lock-utils.datetime_utcnow()).total_seconds()) return max(0, (self._next_lock-utils.datetime_utcnow()).total_seconds())
def call(self): def call(self):
if self.next() == 0:
self.lock() self.lock()
def unlock(self): def unlock(self):