use larger query batch size
Change-Id: I5ef5bcc265daf1185df7ffd9957cd2591bf8ea08 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
fa9c110028
commit
7a8e653b49
@ -13,6 +13,7 @@ from goal_tools import governance
|
|||||||
from goal_tools import storyboard
|
from goal_tools import storyboard
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
BATCH_SIZE = 300
|
||||||
|
|
||||||
|
|
||||||
def decode_json(raw):
|
def decode_json(raw):
|
||||||
@ -56,7 +57,7 @@ def query_gerrit(offset=0, only_open=True, extra_query=''):
|
|||||||
raw = requests.get(
|
raw = requests.get(
|
||||||
url,
|
url,
|
||||||
params={
|
params={
|
||||||
'n': '100',
|
'n': str(BATCH_SIZE),
|
||||||
'start': offset,
|
'start': offset,
|
||||||
'q': query,
|
'q': query,
|
||||||
'o': [
|
'o': [
|
||||||
@ -82,7 +83,7 @@ def all_changes(only_open=True, extra_query=''):
|
|||||||
yield from changes
|
yield from changes
|
||||||
|
|
||||||
if changes and changes[-1].get('_more_changes', False):
|
if changes and changes[-1].get('_more_changes', False):
|
||||||
offset += 100
|
offset += BATCH_SIZE
|
||||||
else:
|
else:
|
||||||
LOG.debug('total of %d patches', offset + len(changes))
|
LOG.debug('total of %d patches', offset + len(changes))
|
||||||
break
|
break
|
||||||
@ -259,7 +260,7 @@ def search_cleanup_patches(offset=0):
|
|||||||
raw = requests.get(
|
raw = requests.get(
|
||||||
url,
|
url,
|
||||||
params={
|
params={
|
||||||
'n': '100',
|
'n': str(BATCH_SIZE),
|
||||||
'start': offset,
|
'start': offset,
|
||||||
'q': query,
|
'q': query,
|
||||||
'o': [
|
'o': [
|
||||||
@ -284,7 +285,7 @@ def get_cleanup_changes():
|
|||||||
yield from changes
|
yield from changes
|
||||||
|
|
||||||
if changes and changes[-1].get('_more_changes', False):
|
if changes and changes[-1].get('_more_changes', False):
|
||||||
offset += 100
|
offset += BATCH_SIZE
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user