/// <summary> /// Run the background command. /// </summary> /// <remarks> /// Select the export layers in random order. /// </remarks> /// <param name="context">Command task execution context.</param> public override async Task ExecuteCommandAsync(CommandTaskContext context) { var rng = new Random(); foreach (var layer in exportLayers.OrderBy(i => rng.Next())) { // NOTE: We *must* delete the old dataset first. await _mapService.DeleteDatasetAsync(layer); if (await ExportDatasetAsync(layer)) { if (await _mapService.PublishAsync(layer)) { Logger.LogInformation($"Layer {layer} published with success"); } else { Logger.LogError($"Layer {layer} was not published"); } } } }