mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 19:26:25 +00:00
convert start_monitoring
This commit is contained in:
parent
c88b66fb05
commit
44a8ac8161
@ -625,6 +625,13 @@ COUNT_CHANGED = MessageType(
|
||||
u"The value of a counter has changed.",
|
||||
)
|
||||
|
||||
START_MONITORING = ActionType(
|
||||
u"magic-folder:start-monitoring",
|
||||
[_NICKNAME, _DIRECTION],
|
||||
[],
|
||||
u"Uploader is beginning to monitor the filesystem for uploadable changes.",
|
||||
)
|
||||
|
||||
|
||||
class QueueMixin(HookMixin):
|
||||
"""
|
||||
@ -925,12 +932,17 @@ class Uploader(QueueMixin):
|
||||
recursive=False)#True)
|
||||
|
||||
def start_monitoring(self):
|
||||
self._log("start_monitoring")
|
||||
d = defer.succeed(None)
|
||||
action = START_MONITORING(
|
||||
nickname=self._client.nickname,
|
||||
direction=self._name,
|
||||
)
|
||||
with action.context():
|
||||
d = DeferredContext(defer.succeed(None))
|
||||
|
||||
d.addCallback(lambda ign: self._notifier.startReading())
|
||||
d.addCallback(lambda ign: self._count('dirs_monitored'))
|
||||
d.addBoth(self._call_hook, 'started')
|
||||
return d
|
||||
return d.addActionFinish()
|
||||
|
||||
def stop(self):
|
||||
self._notifier.stopReading()
|
||||
|
Loading…
Reference in New Issue
Block a user