From: David Stainton <dstainton415@gmail.com>
Date: Thu, 17 Dec 2015 21:46:04 +0000 (+0200)
Subject: Fix uploader's _process to extend queue after scan and count stats properly
X-Git-Url: https://git.rkrishnan.org/components/%22news.html/frontends/somewhere?a=commitdiff_plain;h=a0f4a2a817e826b7bc4404d77317cf60b1c5f1eb;p=tahoe-lafs%2Ftahoe-lafs.git

Fix uploader's _process to extend queue after scan and count stats properly
---

diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py
index 315ee704..f3da04c6 100644
--- a/src/allmydata/frontends/magic_folder.py
+++ b/src/allmydata/frontends/magic_folder.py
@@ -255,7 +255,7 @@ class Uploader(QueueMixin):
 
     def _full_scan(self):
         print "FULL SCAN"
-        self._log("all_files %r" % (self._pending))
+        self._log("_pending %r" % (self._pending))
         self._scan(u"")
 
     def _add_pending(self, relpath_u):
@@ -381,14 +381,15 @@ class Uploader(QueueMixin):
                 encoded_path_u += magicpath.path2magic(u"/")
                 self._log("encoded_path_u =  %r" % (encoded_path_u,))
                 upload_d = self._upload_dirnode.add_file(encoded_path_u, uploadable, metadata={"version":0}, overwrite=True)
-                def _succeeded(ign):
+                def _dir_succeeded(ign):
                     self._log("created subdirectory %r" % (relpath_u,))
                     self._count('directories_created')
-                def _failed(f):
+                def _dir_failed(f):
                     self._log("failed to create subdirectory %r" % (relpath_u,))
                     return f
-                upload_d.addCallbacks(_succeeded, _failed)
+                upload_d.addCallbacks(_dir_succeeded, _dir_failed)
                 upload_d.addCallback(lambda ign: self._scan(relpath_u))
+                upload_d.addCallback(lambda ign: self._extend_queue_and_keep_going(self._pending))
                 return upload_d
             elif pathinfo.isfile:
                 db_entry = self._db.get_db_entry(relpath_u)