Timer restart issue
sigurd-ss opened this issue · 0 comments
sigurd-ss commented
Lines 37 to 38 in eb74cd0
I believe the lines 37&38 should be inside the while loop. After exiting the while loop, the function "run" will call the timeout_callback, but will always end after that.
def run(self): """ The generator function used in simulations. """ while self.env.now < self.timer_expiry: yield self.env.timeout(self.timer_expiry - self.env.now) if not self.stopped: self.timeout_callback(self.timer_id)
Specifically, when timeout_callback includes a call to "restart", this will have no effect. I assume the intended use of restart is to continue the timer with a new timeout, but that will not happen unless lines 37-38 are inside the while loop.
def restart(self, timeout): """ Restarting the timer with a new timeout value. """ self.timer_started = self.env.now self.timer_expiry = self.timer_started + timeout