Skip to content

Commit

Permalink
Refactor count_bugs to use libmozdata (#4058)
Browse files Browse the repository at this point in the history
  • Loading branch information
YBCS authored Feb 25, 2024
1 parent abd2eb0 commit abcfaef
Showing 1 changed file with 8 additions and 7 deletions.
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

0 comments on commit abcfaef

Please sign in to comment.