]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Simplify upload queue API
authorDaira Hopwood <daira@jacaranda.org>
Tue, 28 Apr 2015 18:39:35 +0000 (19:39 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 28 Apr 2015 18:39:35 +0000 (19:39 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/drop_upload.py

index e5174d043e26197dab098e8dcac1ed150a65794b..ed16c893c800909a626ff015c27d96dba9bb3a84 100644 (file)
@@ -105,7 +105,7 @@ class DropUploader(service.MultiService):
             elif os.path.isfile(childpath) and not os.path.islink(childpath):
                 must_upload = self._check_db_file(childpath)
                 if must_upload:
-                    self._add_to_dequeue(childpath)
+                    self._append_to_deque(childpath)
             else:
                 if os.path.islink(childpath):
                     self.warn("WARNING: cannot backup symlink %s" % quote_local_unicode_path(childpath))
@@ -137,9 +137,8 @@ class DropUploader(service.MultiService):
         self.is_upload_ready = True
         self._process_deque()
 
-    def _append_to_deque(self, func, path, event_mask):
-        thunk = (func, path, event_mask)
-        self._upload_deque.append(thunk)
+    def _append_to_deque(self, path):
+        self._upload_deque.append(path)
         self._pending.add(path)
         if self.is_upload_ready:
             self._process_deque()
@@ -147,9 +146,8 @@ class DropUploader(service.MultiService):
     def _process_deque(self):
         while True:
             try:
-                fields = self._upload_deque.pop()
-                func = fields[0]
-                func(*fields[1:])
+                path = self._upload_deque.pop()
+                self._process(path)
             except IndexError:
                 break
 
@@ -157,9 +155,9 @@ class DropUploader(service.MultiService):
         self._log("inotify event %r, %r, %r\n" % (opaque, path, ', '.join(self._inotify.humanReadableMask(events_mask))))
         self._stats_provider.count('drop_upload.files_queued', 1)
         if path not in self._pending:
-            self._append_to_deque(self._process, path, events_mask)
+            self._append_to_deque(path)
 
-    def _process(self, path, events_mask):
+    def _process(self, path):
         d = defer.succeed(None)
 
         # FIXME (ticket #1712): if this already exists as a mutable file, we replace the