Skip to content

Commit 3ee9341

Browse files
committed
fix(DbContextHealthCheck): propagate OperationCanceledExceptions instead of reporting unhealthy
1 parent c7415ff commit 3ee9341

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Middleware/HealthChecks.EntityFrameworkCore/src/DbContextHealthCheck.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context
4141

4242
return new HealthCheckResult(context.Registration.FailureStatus);
4343
}
44-
catch (Exception exception)
44+
catch (Exception exception) when (exception is not OperationCanceledException || !cancellationToken.IsCancellationRequested)
4545
{
4646
return HealthCheckResult.Unhealthy(exception.Message, exception);
4747
}

0 commit comments

Comments
 (0)