1
0
Fork 0

Fix event/timer issue if very close to 0

This commit is contained in:
nemunaire 2016-01-22 19:52:21 +01:00
parent 09e3b082c1
commit 6ad979a5eb
1 changed files with 3 additions and 5 deletions

View File

@ -380,11 +380,9 @@ class Bot(threading.Thread):
self.event_timer.cancel()
if len(self.events):
logger.debug("Update timer: next event in %d seconds",
self.events[0].time_left.seconds)
self.event_timer = threading.Timer(
self.events[0].time_left.seconds + self.events[0].time_left.microseconds / 1000000 if datetime.now(timezone.utc) < self.events[0].current else 0,
self._end_event_timer)
remaining = self.events[0].time_left.seconds + self.events[0].time_left.microseconds / 1000000
logger.debug("Update timer: next event in %d seconds", remaining)
self.event_timer = threading.Timer(remaining if remaining > 0 else 0, self._end_event_timer)
self.event_timer.start()
else: