mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-03 03:36:44 +00:00
make sure shutdown failures go somewhere good
This commit is contained in:
parent
ebd017cf2b
commit
7a9f52d2e5
@ -22,6 +22,7 @@ from eliot import (
|
||||
Field,
|
||||
ActionType,
|
||||
MessageType,
|
||||
write_failure,
|
||||
)
|
||||
from eliot.twisted import DeferredContext
|
||||
|
||||
@ -406,10 +407,7 @@ class MagicFolder(service.MultiService):
|
||||
|
||||
def stopService(self):
|
||||
with MAGIC_FOLDER_STOP(nickname=self.name).context():
|
||||
d = DeferredContext(defer.gatherResults([
|
||||
self.uploader.stop(),
|
||||
self.downloader.stop(),
|
||||
]))
|
||||
d = DeferredContext(self._finish())
|
||||
d.addBoth(
|
||||
lambda ign: service.MultiService.stopService(self)
|
||||
)
|
||||
@ -422,6 +420,14 @@ class MagicFolder(service.MultiService):
|
||||
self.uploader.start_uploading() # synchronous, returns None
|
||||
return self.downloader.start_downloading()
|
||||
|
||||
def _finish(self):
|
||||
d0 = self.downloader.stop()
|
||||
d1 = self.uploader.stop()
|
||||
return defer.DeferredList([
|
||||
DeferredContext(d0).addErrback(write_failure).result,
|
||||
DeferredContext(d1).addErrback(write_failure).result,
|
||||
])
|
||||
|
||||
|
||||
_NICKNAME = Field.for_types(
|
||||
u"nickname",
|
||||
|
Loading…
Reference in New Issue
Block a user