mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-13 22:03:04 +00:00
Speed up MagicFolder service shutdown
Also work-around a tricky, mysterious failure in the test suite by explicitly flushing the eventual call queue. I don't understand where the call that is landing there comes from or why some other part of the code isn't properly waiting on it.
This commit is contained in:
parent
644fd04d08
commit
89bb68254b
@ -712,6 +712,8 @@ class Uploader(QueueMixin):
|
||||
d = self._notifier.wait_until_stopped()
|
||||
else:
|
||||
d = defer.succeed(None)
|
||||
# Speed up shutdown
|
||||
self._processing.cancel()
|
||||
# wait for processing loop to actually exit
|
||||
d.addCallback(lambda ign: self._processing)
|
||||
return d
|
||||
@ -1198,6 +1200,10 @@ class Downloader(QueueMixin, WriteFileMixin):
|
||||
def stop(self):
|
||||
self._log("stop")
|
||||
self._stopped = True
|
||||
|
||||
# Speed up shutdown
|
||||
self._processing.cancel()
|
||||
|
||||
d = defer.succeed(None)
|
||||
# wait for processing loop to actually exit
|
||||
d.addCallback(lambda ign: self._processing)
|
||||
|
@ -1448,6 +1448,9 @@ class SingleMagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, Reall
|
||||
self.local_dir = os.path.join(self.basedir, u"local_dir")
|
||||
self.mkdir_nonascii(self.local_dir)
|
||||
|
||||
from foolscap.eventual import flushEventualQueue
|
||||
self.addCleanup(flushEventualQueue)
|
||||
|
||||
d = self.create_invite_join_magic_folder(self.alice_nickname, self.local_dir)
|
||||
d.addCallback(self._restart_client)
|
||||
# note: _restart_client ultimately sets self.magicfolder to not-None
|
||||
|
Loading…
x
Reference in New Issue
Block a user