Class SubscriptionHealthSweeperHostedService
Background service that periodically sweeps subscriptions and removes dead ones. Uses heartbeat writes to detect subscriptions whose clients have disconnected.
public sealed class SubscriptionHealthSweeperHostedService : BackgroundService, IHostedService, IDisposable
- Inheritance
-
SubscriptionHealthSweeperHostedService
- Implements
- Inherited Members
Constructors
SubscriptionHealthSweeperHostedService(PubsubSubscriptionManager, ILogger<SubscriptionHealthSweeperHostedService>)
public SubscriptionHealthSweeperHostedService(PubsubSubscriptionManager pubsubManager, ILogger<SubscriptionHealthSweeperHostedService> logger)
Parameters
pubsubManagerPubsubSubscriptionManagerloggerILogger<SubscriptionHealthSweeperHostedService>
Methods
ExecuteAsync(CancellationToken)
This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.
protected override Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
stoppingTokenCancellationTokenTriggered when StopAsync(CancellationToken) is called.
Returns
Remarks
See Worker Services in .NET for implementation guidelines.