-
Notifications
You must be signed in to change notification settings - Fork 126
Fix unnecessary retries on repository existence checks #1487
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
base: main
Are you sure you want to change the base?
Conversation
…y updating GetNonSuccessAsync to retry only on transient 5xx errors, skip deterministic statuses (200/404/301/4xx), add full test coverage, and ensure DoesRepoExist makes a single API call for expected responses. (#1447)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where repository existence checks were unnecessarily retrying on deterministic HTTP responses (200/404/301/4xx), causing performance delays during migrations. The solution changes GetNonSuccessAsync to use HttpRetry with a custom predicate that only retries on transient 5xx server errors.
Key Changes:
- Modified
GetNonSuccessAsyncto selectively retry only on 5xx errors usingHttpRetrywith a custom predicate - Added 5 comprehensive test cases to verify retry behavior for different HTTP status codes
- Updated release notes with user-friendly description of the fix
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Octoshift/Services/GithubClient.cs | Changed GetNonSuccessAsync from using GetWithRetry to HttpRetry with a predicate that only retries on 5xx server errors |
| src/OctoshiftCLI.Tests/Octoshift/Services/GithubClientTests.cs | Replaced single retry test with 5 comprehensive tests covering expected status, unexpected success, server errors, client errors, and redirects |
| RELEASENOTES.md | Added user-friendly release note describing the fix for repository existence check retries |
After thoroughly reviewing this PR, I found no issues. The implementation is solid and follows existing patterns in the codebase. The test coverage is comprehensive, and all changes align with the repository's coding standards. Great work on this fix! 🎉
Unit Test Results 1 files 1 suites 10m 25s ⏱️ Results for commit 2942ea9. |
This PR merges external PR #1478 from @AakashSuresh2003 which fixes issue #1447.
Summary
Modified
GetNonSuccessAsyncto only retry on transient 5xx server errors, eliminating unnecessary retries on deterministic responses (200/404/301/4xx) during repository existence checks.Problem
Previously,
GetNonSuccessAsyncusedGetWithRetrywhich retried on all non-success responses, causing unnecessary delays during migrations when checking repository existence.Solution
Changed to use
HttpRetrywith a custom predicate that only retries on 5xx errors:Impact
DoesRepoExist(): Expects 404 → now returns immediately instead of retryingGetArchiveMigrationUrl(): Expects 302 → now returns immediately instead of retryingTesting
Closes #1447
Merges #1478
cc: @AakashSuresh2003