Class ConnectionReclaimerHostedService
- Namespace
- Virtufin.WebSocketManager.Services
- Assembly
- Virtufin.WebSocketManager.dll
Background service that periodically reclaims connections from dead instances. Prevents connection orphaning when pods are replaced via rolling update.
public sealed class ConnectionReclaimerHostedService : BackgroundService, IHostedService, IDisposable
- Inheritance
-
ConnectionReclaimerHostedService
- Implements
- Inherited Members
Constructors
ConnectionReclaimerHostedService(IDaprConnectionRepository, IInstanceIdProvider, IWebSocketConnectionStore, ILogger<ConnectionReclaimerHostedService>)
Creates a new ConnectionReclaimerHostedService.
public ConnectionReclaimerHostedService(IDaprConnectionRepository repository, IInstanceIdProvider instanceIdProvider, IWebSocketConnectionStore connectionStore, ILogger<ConnectionReclaimerHostedService> logger)
Parameters
repositoryIDaprConnectionRepositoryinstanceIdProviderIInstanceIdProviderconnectionStoreIWebSocketConnectionStoreloggerILogger<ConnectionReclaimerHostedService>
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.