Support >= 2.9 query batching

Change-Id: I78e2f32d16c938153e58c1304575622351271b71
This commit is contained in:
James E. Blair 2015-12-19 09:18:48 -08:00 committed by James E. Blair
parent f21f085d20
commit 76ccd91ff9
1 changed files with 4 additions and 1 deletions

View File

@ -353,8 +353,11 @@ class SyncProjectTask(Task):
for batch in responses: for batch in responses:
changes += batch changes += batch
if batch and '_more_changes' in batch[-1]: if batch and '_more_changes' in batch[-1]:
sortkey = '&N=%s' % (batch[-1]['_sortkey'],)
done = False done = False
if '_sortkey' in batch[-1]:
sortkey = '&N=%s' % (batch[-1]['_sortkey'],)
else:
sortkey = '&start=%s' % (len(batch))
change_ids = [c['id'] for c in changes] change_ids = [c['id'] for c in changes]
with app.db.getSession() as session: with app.db.getSession() as session:
# Winnow the list of IDs to only the ones in the local DB. # Winnow the list of IDs to only the ones in the local DB.