]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Naive periodic full scan
authorDavid Stainton <dstainton415@gmail.com>
Thu, 17 Dec 2015 23:17:01 +0000 (01:17 +0200)
committerDavid Stainton <dstainton415@gmail.com>
Tue, 26 Jan 2016 15:27:20 +0000 (15:27 +0000)
src/allmydata/frontends/magic_folder.py

index f3da04c64e0504daa45d0b173be8aaca2ab55f16..87655951b7b2cd84c90bbb612b1004f9875d8a5e 100644 (file)
@@ -194,6 +194,8 @@ class Uploader(QueueMixin):
         self._notifier = self._inotify.INotify()
         self._pending = set()  # of unicode relpaths
 
+        self._periodic_full_scan_duration = 10 * 60 # perform a full scan every 10 minutes
+
         if hasattr(self._notifier, 'set_pending_delay'):
             self._notifier.set_pending_delay(pending_delay)
 
@@ -222,6 +224,7 @@ class Uploader(QueueMixin):
         self._log("stop")
         self._notifier.stopReading()
         self._count('dirs_monitored', -1)
+        self.periodic_callid.cancel()
         if hasattr(self._notifier, 'wait_until_stopped'):
             d = self._notifier.wait_until_stopped()
         else:
@@ -239,7 +242,7 @@ class Uploader(QueueMixin):
         for relpath_u in all_relpaths:
             self._add_pending(relpath_u)
 
-        self._full_scan()
+        self._periodic_full_scan()
         self._extend_queue_and_keep_going(self._pending)
 
     def _extend_queue_and_keep_going(self, relpaths_u):
@@ -253,6 +256,10 @@ class Uploader(QueueMixin):
             else:
                 self._clock.callLater(0, self._turn_deque)
 
+    def _periodic_full_scan(self):
+        self.periodic_callid = self._clock.callLater(self._periodic_full_scan_duration, self._periodic_full_scan)
+        self._full_scan()
+
     def _full_scan(self):
         print "FULL SCAN"
         self._log("_pending %r" % (self._pending))