WIP debugging and partial fix.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2015-11-02 18:21:52 +00:00
parent 751ef57c51
commit 034f9910b4
2 changed files with 14 additions and 2 deletions

View File

@ -357,7 +357,8 @@ class Uploader(QueueMixin):
self._notifier.watch(fp, mask=self.mask, callbacks=[self._notify], recursive=True) self._notifier.watch(fp, mask=self.mask, callbacks=[self._notify], recursive=True)
uploadable = Data("", self._client.convergence) uploadable = Data("", self._client.convergence)
encoded_path_u += magicpath.path2magic(u"/") _assert(encoded_path_u.endswith(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) upload_d = self._upload_dirnode.add_file(encoded_path_u, uploadable, metadata={"version":0}, overwrite=True)
def _succeeded(ign): def _succeeded(ign):
self._log("created subdirectory %r" % (relpath_u,)) self._log("created subdirectory %r" % (relpath_u,))
@ -521,6 +522,7 @@ class Downloader(QueueMixin, WriteFileMixin):
self._log("all files %s" % files) self._log("all files %s" % files)
d = self._scan_remote_collective() d = self._scan_remote_collective()
d.addBoth(self._logcb, "after _scan_remote_collective 0")
self._turn_deque() self._turn_deque()
return d return d
@ -659,7 +661,7 @@ class Downloader(QueueMixin, WriteFileMixin):
def _when_queue_is_empty(self): def _when_queue_is_empty(self):
d = task.deferLater(self._clock, self._turn_delay, self._scan_remote_collective) d = task.deferLater(self._clock, self._turn_delay, self._scan_remote_collective)
d.addBoth(self._logcb, "after _scan_remote_collective") d.addBoth(self._logcb, "after _scan_remote_collective 1")
d.addCallback(lambda ign: self._turn_deque()) d.addCallback(lambda ign: self._turn_deque())
return d return d

View File

@ -593,6 +593,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
def _check_file(self, name_u, data, temporary=False, directory=False): def _check_file(self, name_u, data, temporary=False, directory=False):
precondition(not (temporary and directory), temporary=temporary, directory=directory) precondition(not (temporary and directory), temporary=temporary, directory=directory)
print "%r._check_file(%r, %r, temporary=%r, directory=%r)" % (self, name_u, data, temporary, directory)
previously_uploaded = self._get_count('uploader.objects_succeeded') previously_uploaded = self._get_count('uploader.objects_succeeded')
previously_disappeared = self._get_count('uploader.objects_disappeared') previously_disappeared = self._get_count('uploader.objects_disappeared')
@ -627,9 +628,18 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_disappeared'), d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_disappeared'),
previously_disappeared + 1)) previously_disappeared + 1))
else: else:
def _here(res, n):
print "here %r %r" % (n, res)
return res
d.addBoth(_here, 1)
d.addCallback(lambda ign: self.upload_dirnode.list())
d.addBoth(_here, 1.5)
d.addCallback(lambda ign: self.upload_dirnode.get(encoded_name_u)) d.addCallback(lambda ign: self.upload_dirnode.get(encoded_name_u))
d.addBoth(_here, 2)
d.addCallback(download_to_data) d.addCallback(download_to_data)
d.addBoth(_here, 3)
d.addCallback(lambda actual_data: self.failUnlessReallyEqual(actual_data, data)) d.addCallback(lambda actual_data: self.failUnlessReallyEqual(actual_data, data))
d.addBoth(_here, 4)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_succeeded'), d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_succeeded'),
previously_uploaded + 1)) previously_uploaded + 1))