diff --git a/src/Runner.Common/RunnerService.cs b/src/Runner.Common/RunnerService.cs index ccaa83f698f..5d7ffb136e0 100644 --- a/src/Runner.Common/RunnerService.cs +++ b/src/Runner.Common/RunnerService.cs @@ -98,7 +98,7 @@ protected async Task RetryRequest(Func> func, return await func(); } // 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))) + catch (Exception ex) when (!cancellationToken.IsCancellationRequested && attempt < maxAttempts && (shouldRetry == null || shouldRetry(ex))) { Trace.Error("Catch exception during request"); Trace.Error(ex);