Example #1
0
        private async Task BackgroundProcessing(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                var workItem = await _taskQueue.DequeueAsync(stoppingToken).ConfigureAwait(false);

                try
                {
                    await workItem(stoppingToken).ConfigureAwait(false);

                    _logger.LogInformation(
                        $"After Generation Building Filling Rate: {_building.GetCurrentFillingRate(_settingsService.MaxPersonsPerBuilding)}");
                }
                catch (Exception exception)
                {
                    _logger.LogError(exception, $"Error occured executing {nameof(workItem)}");
                }
            }
        }
 private float GetCurrentFillingRate()
 => _building.GetCurrentFillingRate(_settingsService.MaxPersonsPerBuilding);