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

Change: Fix endless loop in GitHubAsyncRESTClient.get_all #1076

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

n-thumann
Copy link
Member

@n-thumann n-thumann commented Dec 16, 2024

What

This PR fixes an endless loop in GitHubAsyncRESTClient.get_all, caused by unexpected behavior of httpx.

Why

In the current release httpx doesn't merge the params of the URL and the ones in params, but params will replace the URL. This causes us to request the first page over and over again, because params=params will replace page parameter, which is part of the string that _get_next_url returns.
This has been introduced by encode/httpx#3433. Because this seems to be expected behavior (debatable IMHO), I opted to work around this instead of just pinning the httpx version to the previously working one.

You can confirm this fix by using e.g. download-artifact and using this branch for pontos. Without this fix, it'll take forever and at some point likely exceed out API quota.

References

Jira: https://jira.greenbone.net/browse/VTA-630

Checklist

  • Tests

@n-thumann n-thumann added the make release To trigger GitHub release action. label Dec 16, 2024
@n-thumann n-thumann requested a review from a team as a code owner December 16, 2024 11:20
@greenbonebot greenbonebot enabled auto-merge (rebase) December 16, 2024 11:20
Copy link

github-actions bot commented Dec 16, 2024

Conventional Commits Report

Type Number
Changed 2

🚀 Conventional commits found.

y0urself
y0urself previously approved these changes Dec 16, 2024
@y0urself
Copy link
Member

I think you need to adjust the tests ...

@n-thumann
Copy link
Member Author

@y0urself Adjusted my line of code instead to match the unit test and not the unit test. I think it's little cleaner to not expects empty httpx.QueryParams in the unit tests, but keep expecing None.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.31%. Comparing base (25361ff) to head (be59e78).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1076   +/-   ##
=======================================
  Coverage   90.31%   90.31%           
=======================================
  Files         108      108           
  Lines        7187     7188    +1     
  Branches      815      815           
=======================================
+ Hits         6491     6492    +1     
  Misses        491      491           
  Partials      205      205           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@greenbonebot greenbonebot merged commit 2a202d2 into main Dec 16, 2024
21 checks passed
@greenbonebot greenbonebot deleted the fix_endless_loop_get_all branch December 16, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
make release To trigger GitHub release action.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants