#3627 enhancement new
TimerService can stop without notice
|Reported by:||amaury||Owned by:||amaury|
When the TimerService function fails (either with an exception or by returning a deferred that will errback) the internal LoopingCall stops.
But there is no way for the application to handle this, at least with a public API. the service.running attribute is still true! Now I see two workarounds:
- periodically check service._loop.running
- override TimerService._failed and handle the error there.
But I'd prefer a more official way to do this (i.e. without leading underscores).
A solution could be to force a TimerService to stop when the LoopingCall terminates. I suggest the change TimerService._failed like this:
def _failed(self, why): self.stopService() log.err(why)
This also removes the need for the "self._loop.running = False" statement.