summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-09-15 20:05:07 -0300
committerVictor Shyba <victor1984@riseup.net>2017-10-05 05:41:40 -0300
commit4fa10253527d67ab687d8f44a1c72ab6975a9778 (patch)
treeed239f6c2f5c9b6f08b0e8fa774d81bb00f6a254 /src/leap
parent30a707786dfe9fb68855fad489817efed0d0b329 (diff)
[feature] filter out unavailable blobs on listing
-- Related: #8822
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/soledad/client/_db/blobs.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/leap/soledad/client/_db/blobs.py b/src/leap/soledad/client/_db/blobs.py
index ab9de8dd..4b90f8f2 100644
--- a/src/leap/soledad/client/_db/blobs.py
+++ b/src/leap/soledad/client/_db/blobs.py
@@ -72,6 +72,7 @@ class SyncStatus:
PENDING_DOWNLOAD = 3
FAILED_UPLOAD = 4
FAILED_DOWNLOAD = 5
+ UNAVAILABLE_STATUSES = (3, 5)
class ConnectionPool(adbapi.ConnectionPool):
@@ -573,6 +574,11 @@ class SQLiteBlobBackend(object):
if sync_status:
query += ' and sync_status = ?'
values += (sync_status,)
+ else:
+ avoid_values = SyncStatus.UNAVAILABLE_STATUSES
+ query += ' AND sync_status NOT IN (%s)'
+ query %= ','.join(['?' for _ in avoid_values])
+ values += avoid_values
result = yield self.dbpool.runQuery(query, values)
if result:
defer.returnValue([b_id[0] for b_id in result])