From f103e2c9d27a0296ee534da7fa3c491e29c5599e Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Mon, 9 Oct 2023 12:45:11 -0400 Subject: [PATCH] refactor count_bugs to use libmozdata (#3676) --- bugbug/bugzilla.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bugbug/bugzilla.py b/bugbug/bugzilla.py index 14e9933e8d..4be43a4a3a 100644 --- a/bugbug/bugzilla.py +++ b/bugbug/bugzilla.py @@ -282,13 +282,14 @@ def delete_bugs(match): def count_bugs(bug_query_params): bug_query_params["count_only"] = 1 - r = utils.get_session("bugzilla").get( - "https://bugzilla.mozilla.org/rest/bug", params=bug_query_params - ) - r.raise_for_status() - count = r.json()["bug_count"] + counts = [] + + def handler(bug): + counts.append(bug["bug_count"]) + + Bugzilla(bug_query_params, bughandler=handler).get_data().wait() - return count + return sum(counts) def get_product_component_count(months: int = 12) -> dict[str, int]: