From fd0baff0938846a5382016683a7a2cc08ccb4016 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 10 Oct 2019 14:12:58 +0100 Subject: [PATCH] only .call() PollHooks when they're "due" --- src/IRCBot.py | 3 ++- src/LockFile.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/IRCBot.py b/src/IRCBot.py index b1060dbf..2f3d38d0 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -376,7 +376,8 @@ class Bot(object): def _check(self): for poll_timeout in self._poll_timeouts: - poll_timeout.call() + if poll_timeout.next() == 0: + poll_timeout.call() throttle_filled = False for server in list(self.servers.values()): diff --git a/src/LockFile.py b/src/LockFile.py index 9f53b8d5..f7681775 100644 --- a/src/LockFile.py +++ b/src/LockFile.py @@ -32,8 +32,7 @@ class LockFile(PollHook.PollHook): def next(self): return max(0, (self._next_lock-utils.datetime_utcnow()).total_seconds()) def call(self): - if self.next() == 0: - self.lock() + self.lock() def unlock(self): if os.path.isfile(self._lock_location):