Show errors when trying failing to properly stop a component
This commit is contained in:
parent
8f1730591b
commit
2f785216f6
|
@ -98,6 +98,9 @@ class Component(object):
|
||||||
self._component_stopping_deferred = None
|
self._component_stopping_deferred = None
|
||||||
_ComponentRegistry.register(self)
|
_ComponentRegistry.register(self)
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
_ComponentRegistry.deregister(self._component_name)
|
||||||
|
|
||||||
def _component_start_timer(self):
|
def _component_start_timer(self):
|
||||||
if hasattr(self, "update"):
|
if hasattr(self, "update"):
|
||||||
self._component_timer = LoopingCall(self.update)
|
self._component_timer = LoopingCall(self.update)
|
||||||
|
@ -141,11 +144,18 @@ class Component(object):
|
||||||
self._component_timer.stop()
|
self._component_timer.stop()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def on_stop_fail(result):
|
||||||
|
self._component_state = "Started"
|
||||||
|
self._component_stopping_deferred = None
|
||||||
|
log.error(result)
|
||||||
|
return result
|
||||||
|
|
||||||
if self._component_state != "Stopped" and self._component_state != "Stopping":
|
if self._component_state != "Stopped" and self._component_state != "Stopping":
|
||||||
if hasattr(self, "stop"):
|
if hasattr(self, "stop"):
|
||||||
self._component_state = "Stopping"
|
self._component_state = "Stopping"
|
||||||
d = maybeDeferred(self.stop)
|
d = maybeDeferred(self.stop)
|
||||||
d.addCallback(on_stop)
|
d.addCallback(on_stop)
|
||||||
|
d.addErrback(on_stop_fail)
|
||||||
self._component_stopping_deferred = d
|
self._component_stopping_deferred = d
|
||||||
else:
|
else:
|
||||||
d = maybeDeferred(on_stop, None)
|
d = maybeDeferred(on_stop, None)
|
||||||
|
|
Loading…
Reference in New Issue