From f703a2f020a1384e6fbf8b48f494588c92dbe74f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 20 Apr 2021 10:51:24 +0100 Subject: [PATCH] less than total requested can be returned. stop when amount is zero --- src/budget_sync/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/budget_sync/util.py b/src/budget_sync/util.py index 20e7da6..342f685 100644 --- a/src/budget_sync/util.py +++ b/src/budget_sync/util.py @@ -37,6 +37,7 @@ def all_bugs(bz: Bugzilla) -> Iterator[Bug]: while True: bugs = bz.getbugs(list(range(chunk_start, chunk_start + chunk_size))) chunk_start += chunk_size - yield from bugs - if len(bugs) < chunk_size: + print ("bugs loaded", len(bugs), chunk_start) + if len(bugs) == 0: return + yield from bugs -- 2.30.2