Example #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();
            LockProvider.Stop();
        }
Example #2
0
        public void Stop()
        {
            _shutdown = true;

            Logger.LogInformation("Stopping worker threads");
            foreach (var th in _workers)
            {
                th.Stop();
            }

            _workers.Clear();
            Logger.LogInformation("Worker threads stopped");

            QueueProvider.Stop();
            LockProvider.Stop();
        }
Example #3
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();
        }
Example #4
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();
        }
Example #5
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();
        }
Example #6
0
        public void Stop()
        {
            _shutdown = true;

            if (_pollTimer != null)
            {
                _pollTimer.Dispose();
                _pollTimer = null;
            }

            var stashTask = StashUnpublishedEvents();

            Logger.LogInformation("Stopping worker threads");
            foreach (Thread th in _threads)
            {
                th.Join();
            }
            Logger.LogInformation("Worker threads stopped");
            stashTask.Wait();
            QueueProvider.Stop();
            LockProvider.Stop();
        }