Browse Source

Merge "Support SyncQueriedChanges batching in Gerrit >=2.9"

changes/91/391991/1
Jenkins 5 years ago
committed by Gerrit Code Review
parent
commit
94e029ec20
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      gertty/sync.py

+ 6
- 1
gertty/sync.py View File

@ -422,6 +422,7 @@ class SyncQueriedChangesTask(Task):
changes = []
sortkey = ''
done = False
offset = 0
while not done:
# We don't actually want to limit to 500, but that's the server-side default, and
# if we don't specify this, we won't get a _more_changes flag.
@ -432,8 +433,12 @@ class SyncQueriedChangesTask(Task):
if batch:
changes += batch
if '_more_changes' in batch[-1]:
sortkey = '&N=%s' % (batch[-1]['_sortkey'],)
done = False
if '_sortkey' in batch[-1]:
sortkey = '&N=%s' % (batch[-1]['_sortkey'],)
else:
offset += len(batch)
sortkey = '&start=%s' % (offset,)
change_ids = [c['id'] for c in changes]
with app.db.getSession() as session:
# Winnow the list of IDs to only the ones in the local DB.


Loading…
Cancel
Save