[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:
Oleksandr Bezdieniezhnykh
2026-05-11 03:30:07 +03:00
parent ee42b1716b
commit 1dcd089d39
21 changed files with 404 additions and 68 deletions
+2 -2
View File
@@ -161,9 +161,9 @@ async Task<IResult> ServeTile(int z, int x, int y, HttpContext httpContext, ITil
return Results.Bytes(tile.Bytes, tile.ContentType);
}
async Task<IResult> GetTileByLatLon([FromQuery] double Latitude, [FromQuery] double Longitude, [FromQuery] int ZoomLevel, ITileService tileService)
async Task<IResult> GetTileByLatLon([FromQuery] double Latitude, [FromQuery] double Longitude, [FromQuery] int ZoomLevel, HttpContext httpContext, ITileService tileService)
{
var tile = await tileService.DownloadAndStoreSingleTileAsync(Latitude, Longitude, ZoomLevel);
var tile = await tileService.DownloadAndStoreSingleTileAsync(Latitude, Longitude, ZoomLevel, httpContext.RequestAborted);
var response = new DownloadTileResponse
{
+10 -2
View File
@@ -25,7 +25,11 @@
},
"MapConfig": {
"Service": "GoogleMaps",
"ApiKey": ""
"ApiKey": "",
"TileSizePixels": 256,
"AllowedZoomLevels": [ 15, 16, 17, 18, 19 ],
"RetryBaseDelaySeconds": 1,
"RetryMaxDelaySeconds": 30
},
"StorageConfig": {
"TilesDirectory": "./tiles",
@@ -37,7 +41,11 @@
"DefaultZoomLevel": 20,
"QueueCapacity": 1000,
"DelayBetweenRequestsMs": 50,
"SessionTokenReuseCount": 100
"SessionTokenReuseCount": 100,
"RegionProcessingTimeoutSeconds": 300,
"RouteProcessingPollIntervalSeconds": 5,
"MaxRoutePointSpacingMeters": 200.0,
"LatLonTolerance": 0.0001
},
"CorsConfig": {
"AllowedOrigins": []