]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add 'started' hook to Magic Folder uploader.
authorDaira Hopwood <daira@jacaranda.org>
Thu, 3 Sep 2015 19:16:58 +0000 (20:16 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 15 Sep 2015 17:43:00 +0000 (18:43 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py

index ecd3117c242f833f14889c79977cd0a45ad3b04c..6689947a5f2465d8b250dddd5f8f0dc8ee8f7103 100644 (file)
@@ -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):