]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Fix objects_queued counter.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 22 Sep 2015 15:42:02 +0000 (16:42 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 22 Sep 2015 15:42:02 +0000 (16:42 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py

index 96250efde64aba03abea5e1ecae5749ab268760a..7b40708f364597a375adfc8a447828640a1891bc 100644 (file)
@@ -153,6 +153,7 @@ class QueueMixin(HookMixin):
             return
         try:
             item = self._deque.pop()
+            self._count('objects_queued', -1)
         except IndexError:
             self._log("deque is now empty")
             self._lazy_tail.addCallback(lambda ign: self._when_queue_is_empty())
@@ -340,12 +341,10 @@ class Uploader(QueueMixin):
         d.addCallback(_maybe_upload)
 
         def _succeeded(res):
-            self._count('objects_queued', -1)
             self._count('objects_succeeded')
             return res
         def _failed(f):
             print f
-            self._count('objects_queued', -1)
             self._count('objects_failed')
             self._log("%r while processing %r" % (f, relpath_u))
             return f
@@ -497,6 +496,7 @@ class Downloader(QueueMixin):
         print "deque = %r" % (self._deque,)
         self._deque.extend(result)
         print "deque after = %r" % (self._deque,)
+        self._count('objects_queued', len(result))
         print "pending = %r" % (self._pending,)
         self._pending.update(map(lambda x: x[0], result))
         print "pending after = %r" % (self._pending,)