Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Runner.Common/RunnerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ protected async Task<T> RetryRequest<T>(Func<Task<T>> func,
{
return await func();
}
// The caller cancelled this request. BrokerMessageListener cancels its own long
// poll on every Busy -> Idle transition and handles the cancellation itself, so
// rethrow instead of logging a failed request: the backoff below awaits this same
// cancelled token, meaning it is announced but never actually served. Guarded on
// IsCancellationRequested because HttpClient reports a request *timeout* as
// TaskCanceledException with the caller's token uncancelled, and that must retry.
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
{
throw;
}
// TODO: Add handling of non-retriable exceptions: https://github.com/github/actions-broker/issues/122
catch (Exception ex) when (attempt < maxAttempts && (shouldRetry == null || shouldRetry(ex)))
{
Expand Down