jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/761583 )
Change subject: [IMPR] Use site.maxlimit to determine the highest limit to load ......................................................................
[IMPR] Use site.maxlimit to determine the highest limit to load
Bug: T299859 Change-Id: I64631e2d50e4ee1aa23dd491db936213e8253e8e --- M scripts/redirect.py 1 file changed, 3 insertions(+), 6 deletions(-)
Approvals: D3r1ck01: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/redirect.py b/scripts/redirect.py index 8aa1b9e..21e1f1a 100755 --- a/scripts/redirect.py +++ b/scripts/redirect.py @@ -214,15 +214,12 @@
def _next_redirect_group(self) -> Generator[List[pywikibot.Page], None, None]: - """Generator that yields batches of 50 redirects as a list.""" + """Generator that yields batches of redirects as a list.""" chunk = [] - chunks = 0 for page in self.get_redirect_pages_via_api(): chunk.append(str(page.pageid)) - if len(chunk) >= 50: # T299859 - chunks += 1 - if not chunks % 10: - pywikibot.output('.', newline=False) + if len(chunk) >= self.site.maxlimit: + pywikibot.output('.', newline=False) yield chunk chunk.clear() if chunk: