mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-16 21:36:40 +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()
|
||||
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 hasattr(self, "start"):
|
||||
self._component_state = "Starting"
|
||||
d = maybeDeferred(self.start)
|
||||
d.addCallback(on_start)
|
||||
d.addErrback(on_start_fail)
|
||||
self._component_starting_deferred = d
|
||||
else:
|
||||
d = maybeDeferred(on_start, None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user