]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Correct a call to did_upload_version in the downloader.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 13 Oct 2015 14:56:31 +0000 (15:56 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 28 Dec 2015 16:18:52 +0000 (16:18 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py

index e8572d051eb98b4f5365daa899c0988b58ca0168..904fc6fa20457479d385c4efc03926cc9dba037f 100644 (file)
@@ -545,7 +545,9 @@ class Downloader(QueueMixin):
         d.addCallback(lambda ign: self._turn_deque())
         return d
 
-    def _process(self, item):
+    def _process(self, item, now=None):
+        if now is None:
+            now = time.time()
         (relpath_u, file_node, metadata) = item
         d = file_node.download_best_version()
         def succeeded(res):
@@ -555,11 +557,15 @@ class Downloader(QueueMixin):
             d2.addCallback(lambda result: self._write_downloaded_file(abspath_u, result, is_conflict=False))
             def do_update_db(written_abspath_u):
                 filecap = file_node.get_uri()
+                last_uploaded_uri = metadata.get('last_uploaded_uri', None)
+                last_downloaded_uri = filecap
+                last_downloaded_timestamp = now
                 written_pathinfo = get_pathinfo(written_abspath_u)
                 if not written_pathinfo.exists:
                     raise Exception("downloaded file %s disappeared" % quote_local_unicode_path(written_abspath_u))
 
-                self._db.did_upload_version(filecap, relpath_u, metadata['version'], written_pathinfo)
+                self._db.did_upload_version(relpath_u, metadata['version'], last_uploaded_uri,
+                                            last_downloaded_uri, last_downloaded_timestamp, written_pathinfo)
             d2.addCallback(do_update_db)
             # XXX handle failure here with addErrback...
             self._count('objects_downloaded')