public void Stop() { _shutdown = true; Logger.LogInformation("Stopping background tasks"); foreach (var th in _backgroundTasks) { th.Stop(); } Logger.LogInformation("Worker tasks stopped"); QueueProvider.Stop().Wait(); LockProvider.Stop().Wait(); _searchIndex.Stop().Wait(); _lifeCycleEventHub.Stop().Wait(); }
public async Task StopAsync(CancellationToken cancellationToken) { _shutdown = true; Logger.LogInformation("Stopping background tasks"); if (_backgroundTasks is not null) { foreach (var th in _backgroundTasks) { if (th is not null) { try { th.Stop(); } catch (Exception e) { Logger.LogError(e, "Exception thrown during tasks disposal"); } } } } // throw new Exception( // @$"Nuggets 1 //_backgroundTasks is {_backgroundTasks is null} //Logger is {Logger is null} //QueueProvider is {QueueProvider is null} //LockProvider is {LockProvider is null} //_searchIndex is {_searchIndex is null} //_lifeCycleEventHub is {_lifeCycleEventHub is null} //" // ); Logger.LogInformation("Worker tasks stopped"); await QueueProvider.Stop(); await LockProvider.Stop(); await _searchIndex.Stop(); await _lifeCycleEventHub.Stop(); }
public async Task StopAsync(CancellationToken cancellationToken) { _shutdown = true; Logger.LogInformation("Stopping background tasks"); foreach (var th in _backgroundTasks) { th.Stop(); } Logger.LogInformation("Worker tasks stopped"); await QueueProvider.Stop(); await LockProvider.Stop(); await _searchIndex.Stop(); await _lifeCycleEventHub.Stop(); }