示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
        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();
        }