Skip to content

Commit

Permalink
Xabaril#2225 Use failure status rather than default of unhealthy
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson-tomo committed Jun 1, 2024
1 parent 2f6a10f commit 15d7695
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ private void OnStopping()
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();


return Task.FromResult(IsApplicationRunning ? HealthCheckResult.Healthy() : HealthCheckResult.Unhealthy());
return Task.FromResult(IsApplicationRunning ? HealthCheckResult.Healthy() : new HealthCheckResult(context.Registration.FailureStatus));
}

public virtual void Dispose()
Expand Down
2 changes: 1 addition & 1 deletion src/HealthChecks.InfluxDB/InfluxDBHealthCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context
}
catch (Exception ex)
{
return HealthCheckResult.Unhealthy(ex.Message, exception: ex);
return new HealthCheckResult(context.Registration.FailureStatus, ex.Message, exception: ex);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/HealthChecks.System/ProcessHealthCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, Canc
}
catch (Exception ex)
{
return Task.FromResult(new HealthCheckResult(HealthStatus.Unhealthy, exception: ex));
return Task.FromResult(new HealthCheckResult(context.Registration.FailureStatus, exception: ex));
}

return Task.FromResult(new HealthCheckResult(context.Registration.FailureStatus));
Expand Down

0 comments on commit 15d7695

Please sign in to comment.