summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-11-09 03:07:58 -0300
committerVictor Shyba <victor1984@riseup.net>2017-11-13 18:17:04 -0300
commit91d7cd4961c0e158d1dc57e16d243d2394e04d40 (patch)
treecaa46d066e881b34cb2d7f29ee423f4950faaaae /src
parent69090db9acfa7eb33cd431a45c6c28068a20ec66 (diff)
[bug] update pending_upload from server listing
We were doing it for downloads, but not for uploads.
Diffstat (limited to 'src')
-rw-r--r--src/leap/soledad/client/_db/blobs/sql.py6
-rw-r--r--src/leap/soledad/client/_db/blobs/sync.py5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/leap/soledad/client/_db/blobs/sql.py b/src/leap/soledad/client/_db/blobs/sql.py
index c9a025a2..c5b0b64b 100644
--- a/src/leap/soledad/client/_db/blobs/sql.py
+++ b/src/leap/soledad/client/_db/blobs/sql.py
@@ -156,9 +156,11 @@ class SQLiteBlobBackend(object):
def update_batch_sync_status(self, blob_id_list, sync_status,
namespace=''):
- insert = 'INSERT INTO sync_state (blob_id, namespace, sync_status)'
+ if not blob_id_list:
+ return
+ insert = 'INSERT or REPLACE INTO sync_state'
first_blob_id, blob_id_list = blob_id_list[0], blob_id_list[1:]
- insert += ' VALUES (?, ?, ?)'
+ insert += ' (blob_id, namespace, sync_status) VALUES (?, ?, ?)'
values = (first_blob_id, namespace, sync_status)
for blob_id in blob_id_list:
insert += ', (?, ?, ?)'
diff --git a/src/leap/soledad/client/_db/blobs/sync.py b/src/leap/soledad/client/_db/blobs/sync.py
index 838b87e5..bfdc5fbe 100644
--- a/src/leap/soledad/client/_db/blobs/sync.py
+++ b/src/leap/soledad/client/_db/blobs/sync.py
@@ -62,10 +62,15 @@ class BlobsSynchronizer(object):
d2 = self.local_list(namespace=namespace)
remote_list, local_list = yield defer.gatherResults([d1, d2])
pending_download_ids = tuple(set(remote_list) - set(local_list))
+ pending_upload_ids = tuple(set(local_list) - set(remote_list))
yield self.local.update_batch_sync_status(
pending_download_ids,
SyncStatus.PENDING_DOWNLOAD,
namespace=namespace)
+ yield self.local.update_batch_sync_status(
+ pending_upload_ids,
+ SyncStatus.PENDING_UPLOAD,
+ namespace=namespace)
@defer.inlineCallbacks
def send_missing(self, namespace=''):