mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-22 06:01:13 +00:00
[AZ-371] Refactor C18: magic numbers to ProcessingConfig/MapConfig
Promotes 8 operational levers into config keys with defaults that match the prior source literals byte-for-byte: ProcessingConfig: RegionProcessingTimeoutSeconds (300), RouteProcessingPollIntervalSeconds (5), MaxRoutePointSpacingMeters (200), LatLonTolerance (0.0001). MapConfig: TileSizePixels (256), AllowedZoomLevels ([15..19]), RetryBaseDelaySeconds (1), RetryMaxDelaySeconds (30). Sites updated: RegionService, RouteProcessingService, RoutePointGraphBuilder, RouteValidator, RouteService 4-arg ctor, RouteImageRenderer, GoogleMapsDownloaderV2, TileService. Closes LF-2 by forwarding HttpContext.RequestAborted from GetTileByLatLon into the downloader. appsettings.json gains the 8 new keys at default values. Tests: 141 / 141 unit + 5 / 5 smoke green. New ConfigDefaultsTests pins defaults to original literals; new TileService unit test asserts CT identity from caller to downloader (AZ-371 AC-3). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SatelliteProvider.Common.Configs;
|
||||
using SatelliteProvider.Common.DTO;
|
||||
using SatelliteProvider.Common.Interfaces;
|
||||
using SatelliteProvider.Common.Utils;
|
||||
@@ -26,7 +28,7 @@ public class RouteProcessingService : BackgroundService
|
||||
private readonly RegionFileCleaner _regionFileCleaner;
|
||||
private readonly RouteRegionMatcher _routeRegionMatcher;
|
||||
private readonly ILogger<RouteProcessingService> _logger;
|
||||
private readonly TimeSpan _checkInterval = TimeSpan.FromSeconds(5);
|
||||
private readonly TimeSpan _checkInterval;
|
||||
|
||||
public RouteProcessingService(
|
||||
IRouteRepository routeRepository,
|
||||
@@ -37,6 +39,7 @@ public class RouteProcessingService : BackgroundService
|
||||
RouteImageRenderer routeImageRenderer,
|
||||
TilesZipBuilder tilesZipBuilder,
|
||||
RegionFileCleaner regionFileCleaner,
|
||||
IOptions<ProcessingConfig> processingConfig,
|
||||
ILogger<RouteProcessingService> logger)
|
||||
{
|
||||
_routeRepository = routeRepository;
|
||||
@@ -48,6 +51,7 @@ public class RouteProcessingService : BackgroundService
|
||||
_tilesZipBuilder = tilesZipBuilder;
|
||||
_regionFileCleaner = regionFileCleaner;
|
||||
_routeRegionMatcher = new RouteRegionMatcher();
|
||||
_checkInterval = TimeSpan.FromSeconds(processingConfig.Value.RouteProcessingPollIntervalSeconds);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user