Skip to content

Commit

Permalink
fix: Dispose CancellationTokenSource
Browse files Browse the repository at this point in the history
  • Loading branch information
oboukli committed Dec 2, 2023
1 parent beeff09 commit ff654a3
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ public HealthCheckBackgroundService(
new Thread(new ThreadStart(MakeStartDelegate(livenessListener))) { IsBackground = true };
}

private void Dispose(bool disposing)

Check warning on line 40 in src/Aktabook.Diagnostics.HealthChecks/HealthCheckBackgroundService.cs

View workflow job for this annotation

GitHub Actions / Quality gate

Either implement 'IDisposable.Dispose', or totally rename this method to prevent confusion.
{
if (disposing)
{
_listenerStoppingTokenSource.Dispose();
}
}

public override void Dispose()
{
Dispose(true);
base.Dispose();
GC.SuppressFinalize(this);

Check warning on line 52 in src/Aktabook.Diagnostics.HealthChecks/HealthCheckBackgroundService.cs

View workflow job for this annotation

GitHub Actions / Quality gate

Remove this useless call to 'GC.SuppressFinalize'.
}

protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await Task.Yield();
Expand Down

0 comments on commit ff654a3

Please sign in to comment.