From 4fa10253527d67ab687d8f44a1c72ab6975a9778 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 15 Sep 2017 20:05:07 -0300 Subject: [feature] filter out unavailable blobs on listing -- Related: #8822 --- src/leap/soledad/client/_db/blobs.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/leap') 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]) -- cgit v1.2.3