예제 #1
0
        private async Task BackgroundProceessing()
        {
            while (!_shutdown.IsCancellationRequested)
            {
                var workItemAsync = await _taskQueue.DequeueAsync(_shutdown.Token);

                try
                {
                    await workItemAsync(_shutdown.Token);
                }
                catch (Exception)
                {
                    _logger.Log(LogLevel.Error, new EventId((int)LogEventId.General), $"Error occurred executing {nameof(workItemAsync)}.");
                }
            }
        }