mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-19 22:58:30 +00:00
Add an errback for when calling a component's start() fails and revert it back to a Stopped
state in this case
This commit is contained in:
parent
84b33c3418
commit
afa283cd2d
@ -108,11 +108,18 @@ class Component(object):
|
|||||||
self._component_start_timer()
|
self._component_start_timer()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def on_start_fail(result):
|
||||||
|
self._component_state = "Stopped"
|
||||||
|
self._component_starting_deferred = None
|
||||||
|
log.error(result)
|
||||||
|
return result
|
||||||
|
|
||||||
if self._component_state == "Stopped":
|
if self._component_state == "Stopped":
|
||||||
if hasattr(self, "start"):
|
if hasattr(self, "start"):
|
||||||
self._component_state = "Starting"
|
self._component_state = "Starting"
|
||||||
d = maybeDeferred(self.start)
|
d = maybeDeferred(self.start)
|
||||||
d.addCallback(on_start)
|
d.addCallback(on_start)
|
||||||
|
d.addErrback(on_start_fail)
|
||||||
self._component_starting_deferred = d
|
self._component_starting_deferred = d
|
||||||
else:
|
else:
|
||||||
d = maybeDeferred(on_start, None)
|
d = maybeDeferred(on_start, None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user