Merge "Support SyncQueriedChanges batching in Gerrit >=2.9"
This commit is contained in:
commit
94e029ec20
@ -422,6 +422,7 @@ class SyncQueriedChangesTask(Task):
|
|||||||
changes = []
|
changes = []
|
||||||
sortkey = ''
|
sortkey = ''
|
||||||
done = False
|
done = False
|
||||||
|
offset = 0
|
||||||
while not done:
|
while not done:
|
||||||
# We don't actually want to limit to 500, but that's the server-side default, and
|
# 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.
|
# if we don't specify this, we won't get a _more_changes flag.
|
||||||
@ -432,8 +433,12 @@ class SyncQueriedChangesTask(Task):
|
|||||||
if batch:
|
if batch:
|
||||||
changes += batch
|
changes += batch
|
||||||
if '_more_changes' in batch[-1]:
|
if '_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:
|
||||||
|
offset += len(batch)
|
||||||
|
sortkey = '&start=%s' % (offset,)
|
||||||
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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user