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 (#3676) #3704

Closed
wants to merge 1 commit into from

Conversation

issamarabi
Copy link

Closes #3676

Refactored the count_bugs function in bugbug/bugzilla.py to utilize the Bugzilla class from libmozdata.bugzilla instead of making a direct request.

The previous approach involved sending a direct GET request to Bugzilla's REST API. This approach might not be sustainable and consistent in the long run, especially if there are updates or changes to the API.

By using the libmozdata.bugzilla library, we aim for a more maintainable and robust method of counting bugs. It also keeps our codebase consistent with other parts where the Bugzilla class is used.

Copy link
Member

@suhaibmujahid suhaibmujahid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @issamarabi. Thank you for your interest in the project. See my feedback below and
please test the function locally to make sure that things work as expected.

def handler(bug):
counts.append(bug["bug_count"])

Bugzilla(bug_query_params, bughandler=handler).get_data().wait()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using bughandler expect to receive a response that has the property bugs: https://bugzilla.mozilla.org/rest/bug?id=1234567. However, passing the count_only returns JSON object that contains bug_count: https://bugzilla.mozilla.org/rest/bug?id=1234567&count_only=1

Thus, you need to pass the Query class to handle this, example:

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

@suhaibmujahid
Copy link
Member

suhaibmujahid commented Feb 25, 2024

Closing for lack of response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor count_bugs to use libmozdata
2 participants