mirror of
https://github.com/actions/runner.git
synced 2025-12-17 15:59:37 +00:00
Don't retry uploads when the http status code response from the server is in the 400's (#131)
* Don't retry uploads when the http status code response from the server is in the 400's * Don't retry on fast-fail * Feedback from code review * Always try to attach any uploaded files to the build Don't fast-fail on 'Conflict' * Add dispose * Refactored upload code. Called out specialized 'Conflict' logic. * Added typed exception.
This commit is contained in:
@@ -397,6 +397,11 @@ namespace GitHub.Services.FileContainer.Client
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (IsFastFailResponse(response))
|
||||
{
|
||||
FileUploadTrace(itemPath, $"Chunk '{currentChunk}' attempt '{attempt}' of file '{itemPath}' received non-success status code {response.StatusCode} for sending request and cannot continue.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileUploadTrace(itemPath, $"Chunk '{currentChunk}' attempt '{attempt}' of file '{itemPath}' received non-success status code {response.StatusCode} for sending request.");
|
||||
@@ -538,6 +543,17 @@ namespace GitHub.Services.FileContainer.Client
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
public bool IsFastFailResponse(HttpResponseMessage response)
|
||||
{
|
||||
int statusCode = (int)response?.StatusCode;
|
||||
return statusCode >= 400 && statusCode <= 499;
|
||||
}
|
||||
|
||||
protected override bool ShouldThrowError(HttpResponseMessage response)
|
||||
{
|
||||
return !response.IsSuccessStatusCode && !IsFastFailResponse(response);
|
||||
}
|
||||
|
||||
private async Task<HttpResponseMessage> ContainerGetRequestAsync(
|
||||
Int64 containerId,
|
||||
String itemPath,
|
||||
|
||||
Reference in New Issue
Block a user