From: Daira Hopwood Date: Thu, 3 Sep 2015 19:16:58 +0000 (+0100) Subject: Add 'started' hook to Magic Folder uploader. X-Git-Url: https://git.rkrishnan.org/simplejson/frontends/FTP-and-SFTP.rst?a=commitdiff_plain;h=8771a4100037d019d624375234150c4a2ea923b6;p=tahoe-lafs%2Ftahoe-lafs.git Add 'started' hook to Magic Folder uploader. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 0958f067..e0825978 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -95,7 +95,8 @@ class QueueMixin(HookMixin): self._local_path = to_filepath(local_path_u) self._db = db self._name = name - self._hooks = {'processed': None} + self._hooks = {'processed': None, 'started': None} + self.started_d = self.set_hook('started') if not self._local_path.exists(): raise AssertionError("The '[magic_folder] local.directory' parameter was %s " @@ -180,8 +181,11 @@ class Uploader(QueueMixin): recursive=True) def start_monitoring(self): - d = self._notifier.startReading() - self._count('dirs_monitored') + print "start_monitoring" + d = 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 def stop(self):