-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When calling the migrate-repo command it is checked if the target repository already exists. If the repository is found then the check method retries the call 5 time before throwing a exception. This is the call stack:
gh-gei/src/Octoshift/Services/GithubApi.cs
Lines 170 to 186 in b380004
| public virtual async Task<bool> DoesRepoExist(string org, string repo) | |
| { | |
| var url = $"{_apiUrl}/repos/{org.EscapeDataString()}/{repo.EscapeDataString()}"; | |
| try | |
| { | |
| await _client.GetNonSuccessAsync(url, HttpStatusCode.NotFound); | |
| return false; | |
| } | |
| catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.OK) | |
| { | |
| return true; | |
| } | |
| catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.MovedPermanently) | |
| { | |
| return false; | |
| } | |
| } |
| public virtual async Task<string> GetNonSuccessAsync(string url, HttpStatusCode status) => (await GetWithRetry(url, expectedStatus: status)).Content; |
The GetNonSuccessAsync() function calls a GetWithRetry() by passing an expected HttpStatusCode.
IMO the GetNonSuccessAsync() function should call a sub-function without retry and should fail if the expected HttpStatusCode is returned, or is this behavior intentional?
Reproduction Steps
Run a migration against an existing repository.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working