only .call() PollHooks when they're "due"
This commit is contained in:
parent
1c792f0194
commit
fd0baff093
2 changed files with 3 additions and 3 deletions
|
@ -376,7 +376,8 @@ class Bot(object):
|
||||||
|
|
||||||
def _check(self):
|
def _check(self):
|
||||||
for poll_timeout in self._poll_timeouts:
|
for poll_timeout in self._poll_timeouts:
|
||||||
poll_timeout.call()
|
if poll_timeout.next() == 0:
|
||||||
|
poll_timeout.call()
|
||||||
|
|
||||||
throttle_filled = False
|
throttle_filled = False
|
||||||
for server in list(self.servers.values()):
|
for server in list(self.servers.values()):
|
||||||
|
|
|
@ -32,8 +32,7 @@ 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):
|
||||||
if os.path.isfile(self._lock_location):
|
if os.path.isfile(self._lock_location):
|
||||||
|
|
Loading…
Reference in a new issue