]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Simplification of _upload_lazy_tail.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 21 Apr 2015 22:10:35 +0000 (23:10 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 28 Apr 2015 18:46:48 +0000 (19:46 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/drop_upload.py

index a7958a489b45f683306b3c27a66b1e74ef4e71c9..3f5299049b608378257f40727274f4f2ba2803f1 100644 (file)
@@ -40,7 +40,7 @@ class DropUploader(service.MultiService):
 
         self._objid = None
         self._classname = 'DropUploader'
-        self._upload_lazy_tail = None
+        self._upload_lazy_tail = defer.succeed(None)
         self._pending = set()
         self._client = client
         self._stats_provider = client.stats_provider
@@ -178,12 +178,9 @@ class DropUploader(service.MultiService):
             path = self._upload_deque.pop()
         except IndexError:
             self._log("magic folder upload deque is now empty")
-            self._upload_lazy_tail = None
+            self._upload_lazy_tail = defer.succeed(None)
             return
-        if self._upload_lazy_tail is not None:
-            self._upload_lazy_tail.addCallback(lambda ign: task.deferLater(reactor, 0, self._process, path))
-        else:
-            self._upload_lazy_tail = task.deferLater(reactor, 0, self._process, path)
+        self._upload_lazy_tail.addCallback(lambda ign: task.deferLater(reactor, 0, self._process, path))
         self._upload_lazy_tail.addCallback(lambda ign: self._turn_deque())
 
     def _notify(self, opaque, path, events_mask):