From 1dfd89ab12886bafa61875d38b340a366ea45d3b Mon Sep 17 00:00:00 2001 From: Uchechukwu Orji Date: Wed, 7 Aug 2024 16:07:25 +0100 Subject: [PATCH] conditionally raise stopiteration after yielding tests --- worker/manager/src/mirrors_qa_manager/worker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/manager/src/mirrors_qa_manager/worker.py b/worker/manager/src/mirrors_qa_manager/worker.py index e472803..52456c4 100644 --- a/worker/manager/src/mirrors_qa_manager/worker.py +++ b/worker/manager/src/mirrors_qa_manager/worker.py @@ -311,11 +311,11 @@ def fetch_tests(self) -> Iterable[dict[str, str]]: f"Fetched page {current_page} of {last_page} of pending tests." ) + yield from data["tests"] + if current_page == last_page: raise StopIteration - yield from data["tests"] - def sleep(self) -> None: logger.info(f"Sleeping for {Settings.SLEEP_SECONDS}s") time.sleep(Settings.SLEEP_SECONDS)