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

View File

@ -380,11 +380,9 @@ class Bot(threading.Thread):
self.event_timer.cancel() self.event_timer.cancel()
if len(self.events): if len(self.events):
logger.debug("Update timer: next event in %d seconds", remaining = self.events[0].time_left.seconds + self.events[0].time_left.microseconds / 1000000
self.events[0].time_left.seconds) logger.debug("Update timer: next event in %d seconds", remaining)
self.event_timer = threading.Timer( self.event_timer = threading.Timer(remaining if remaining > 0 else 0, self._end_event_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)
self.event_timer.start() self.event_timer.start()
else: else: