convert stop(_monitoring)
This commit is contained in:
parent
44a8ac8161
commit
28a4a61dab
|
@ -632,6 +632,13 @@ START_MONITORING = ActionType(
|
|||
u"Uploader is beginning to monitor the filesystem for uploadable changes.",
|
||||
)
|
||||
|
||||
STOP_MONITORING = ActionType(
|
||||
u"magic-folder:stop-monitoring",
|
||||
[_NICKNAME, _DIRECTION],
|
||||
[],
|
||||
u"Uploader is terminating filesystem monitoring operation.",
|
||||
)
|
||||
|
||||
|
||||
class QueueMixin(HookMixin):
|
||||
"""
|
||||
|
@ -945,6 +952,11 @@ class Uploader(QueueMixin):
|
|||
return d.addActionFinish()
|
||||
|
||||
def stop(self):
|
||||
action = STOP_MONITORING(
|
||||
nickname=self._client.nickname,
|
||||
direction=self._name,
|
||||
)
|
||||
with action.context():
|
||||
self._notifier.stopReading()
|
||||
self._count('dirs_monitored', -1)
|
||||
if self._periodic_callid:
|
||||
|
@ -954,12 +966,12 @@ class Uploader(QueueMixin):
|
|||
pass
|
||||
|
||||
if hasattr(self._notifier, 'wait_until_stopped'):
|
||||
d = self._notifier.wait_until_stopped()
|
||||
d = DeferredContext(self._notifier.wait_until_stopped())
|
||||
else:
|
||||
d = defer.succeed(None)
|
||||
d = DeferredContext(defer.succeed(None))
|
||||
|
||||
d.addCallback(lambda ignored: QueueMixin.stop(self))
|
||||
return d
|
||||
return d.addActionFinish()
|
||||
|
||||
def start_uploading(self):
|
||||
self._log("start_uploading")
|
||||
|
|
Loading…
Reference in New Issue