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:
|
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.
Description
When calling the
migrate-repocommand 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
gh-gei/src/Octoshift/Services/GithubClient.cs
Line 48 in b380004
The
GetNonSuccessAsync()function calls aGetWithRetry()by passing an expectedHttpStatusCode.IMO the
GetNonSuccessAsync()function should call a sub-function without retry and should fail if the expectedHttpStatusCodeis returned, or is this behavior intentional?Reproduction Steps
Run a migration against an existing repository.