From e0e90a250f839a9d43c771034ba5429e11e578da Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 21 Apr 2015 23:10:35 +0100 Subject: [PATCH] Simplification of _upload_lazy_tail. Signed-off-by: Daira Hopwood --- src/allmydata/frontends/drop_upload.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py index f84cf05b..0b3287c5 100644 --- a/src/allmydata/frontends/drop_upload.py +++ b/src/allmydata/frontends/drop_upload.py @@ -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 @@ -173,12 +173,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): -- 2.45.2