Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor count_bugs to use libmozdata #4058

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions bugbug/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import tenacity
from dateutil.relativedelta import relativedelta
from libmozdata.bugzilla import Bugzilla, BugzillaProduct
from libmozdata.bugzilla import Bugzilla, BugzillaProduct, Query
from tqdm import tqdm

from bugbug import db, utils
Expand Down Expand Up @@ -290,13 +290,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"]
data = {}

def handler(bug):
data["bug_count"] = bug["bug_count"]

Bugzilla(queries=Query(Bugzilla.API_URL, bug_query_params, handler)).wait()

return count
return data["bug_count"]


def get_product_component_count(months: int = 12) -> dict[str, int]:
Expand Down