On fast machines (and platforms where time.time() has low resolution),
it's possible to make it through an IOLoop iteration with time.time()
unchanged, which would cause the callback to be run multiple times
regardless of the requested interval.
Closes #366.
def _schedule_next(self):
if self._running:
current_time = time.time()
- while self._next_timeout < current_time:
+ while self._next_timeout <= current_time:
self._next_timeout += self.callback_time / 1000.0
self.io_loop.add_timeout(self._next_timeout, self._run)