improve logging fallback
This commit is contained in:
@@ -215,6 +215,26 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
|
||||
|
||||
await Task.Delay(retryDelay, ct).ConfigureAwait(false);
|
||||
}
|
||||
catch (TaskCanceledException ex) when (!ct.IsCancellationRequested)
|
||||
{
|
||||
response?.Dispose();
|
||||
retryCount++;
|
||||
|
||||
Logger.LogWarning(ex, "Cancellation/timeout during download of {requestUrl}. Attempt {attempt} of {maxRetries}", requestUrl, retryCount, maxRetries);
|
||||
|
||||
if (retryCount >= maxRetries)
|
||||
{
|
||||
Logger.LogError("Max retries reached for {requestUrl} after TaskCanceledException", requestUrl);
|
||||
throw;
|
||||
}
|
||||
|
||||
await Task.Delay(retryDelay, ct).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException) when (ct.IsCancellationRequested)
|
||||
{
|
||||
response?.Dispose();
|
||||
throw;
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
response?.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user