Exemplo n.º 1
0
    public async Task Process(CancellationToken stoppingToken)
    {
        using (_logger.BeginScope(new Dictionary <string, object> {
            ["CorrelationId"] = Guid.NewGuid()
        }))
        {
            if (!_options.ShouldIndexEntries && !_options.ShouldIndexLeagues)
            {
                _logger.LogInformation("Bypassing the indexing job, since config says so");
                return;
            }

            if (_options.ShouldIndexEntries)
            {
                _logger.LogInformation("Starting the entries indexing job");
                await _indexingService.IndexEntries(stoppingToken);

                _logger.LogInformation("Finished indexing all entries");
            }

            if (_options.ShouldIndexLeagues)
            {
                _logger.LogInformation("Starting the league indexing job");
                await _indexingService.IndexLeagues(stoppingToken);

                _logger.LogInformation("Finished indexing all leagues");
            }
        }
    }