private async Task RebuildHighways() { _logger.LogInformation("Starting rebuilding highways database."); using (var stream = _latestFileFetcherExecutor.Get()) { var osmHighways = await _osmRepository.GetAllHighways(stream); var geoJsonHighways = _osmGeoJsonPreprocessorExecutor.Preprocess(osmHighways); await _elasticSearchGateway.UpdateHighwaysZeroDownTime(geoJsonHighways); } _logger.LogInformation("Finished rebuilding highways database."); }
/// <inheritdoc /> public async Task Rebuild(UpdateRequest request, Stream stream) { if (request.Highways) { _logger.LogInformation("Starting rebuilding highways database."); var osmHighways = await _osmRepository.GetAllHighways(stream); var geoJsonHighways = _osmGeoJsonPreprocessorExecutor.Preprocess(osmHighways); await _elasticSearchGateway.UpdateHighwaysZeroDownTime(geoJsonHighways); _logger.LogInformation("Finished rebuilding highways database."); } if (request.PointsOfInterest) { _logger.LogInformation("Starting rebuilding POIs database."); var fetchTask = _adapters.Select(a => a.GetPointsForIndexing(stream)).ToArray(); var features = await Task.WhenAll(fetchTask); await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features.SelectMany(v => v).ToList()); _logger.LogInformation("Finished rebuilding POIs database."); } }