From 7a8e653b499c66b2eb451fe386da2f28d44329cc Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Thu, 7 Feb 2019 07:46:04 -0500 Subject: [PATCH] use larger query batch size Change-Id: I5ef5bcc265daf1185df7ffd9957cd2591bf8ea08 Signed-off-by: Doug Hellmann --- goal_tools/python3_first/patches.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/goal_tools/python3_first/patches.py b/goal_tools/python3_first/patches.py index ff208a8..ae8515a 100644 --- a/goal_tools/python3_first/patches.py +++ b/goal_tools/python3_first/patches.py @@ -13,6 +13,7 @@ from goal_tools import governance from goal_tools import storyboard LOG = logging.getLogger(__name__) +BATCH_SIZE = 300 def decode_json(raw): @@ -56,7 +57,7 @@ def query_gerrit(offset=0, only_open=True, extra_query=''): raw = requests.get( url, params={ - 'n': '100', + 'n': str(BATCH_SIZE), 'start': offset, 'q': query, 'o': [ @@ -82,7 +83,7 @@ def all_changes(only_open=True, extra_query=''): yield from changes if changes and changes[-1].get('_more_changes', False): - offset += 100 + offset += BATCH_SIZE else: LOG.debug('total of %d patches', offset + len(changes)) break @@ -259,7 +260,7 @@ def search_cleanup_patches(offset=0): raw = requests.get( url, params={ - 'n': '100', + 'n': str(BATCH_SIZE), 'start': offset, 'q': query, 'o': [ @@ -284,7 +285,7 @@ def get_cleanup_changes(): yield from changes if changes and changes[-1].get('_more_changes', False): - offset += 100 + offset += BATCH_SIZE else: break