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 b17c840
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)
{
if (disposing)
{
_listenerStoppingTokenSource.Dispose();
}
}

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

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

0 comments on commit b17c840

Please sign in to comment.