mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-25 21:17:37 +00:00
Correct a call to did_upload_version in the downloader.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
fd506bd550
commit
257da9f86d
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user