コード例 #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)}");
                }
            }
        }
コード例 #2
0
 private float GetCurrentFillingRate()
 => _building.GetCurrentFillingRate(_settingsService.MaxPersonsPerBuilding);