mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 09:41:15 +00:00
[AZ-374] Refactor C21: named GoogleMapsTiles HttpClient in DI
- Register IHttpClientFactory named client "GoogleMapsTiles" inside AddTileDownloader() with User-Agent and 100s timeout (preserves HttpClient's implicit default). - Resolve the same named client from all three CreateClient() call sites in GoogleMapsDownloaderV2 (session token, single-tile, batch-tile retry lambda) and drop the duplicated per-call UserAgent.ParseAdd setup. - Expose USER_AGENT, the client name, and the timeout as internal consts on GoogleMapsDownloaderV2 so the extension and the downloader share one source of truth. - Add AC test that builds the DI container, resolves the named client, and asserts both the User-Agent header and the timeout. - Archive AZ-374 task file: todo/ -> done/. 175 unit + 5 smoke pass. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,6 +8,11 @@ public static class TileDownloaderServiceCollectionExtensions
|
||||
public static IServiceCollection AddTileDownloader(this IServiceCollection services)
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
services.AddHttpClient(GoogleMapsDownloaderV2.GoogleMapsTilesClientName, c =>
|
||||
{
|
||||
c.DefaultRequestHeaders.UserAgent.ParseAdd(GoogleMapsDownloaderV2.UserAgent);
|
||||
c.Timeout = TimeSpan.FromSeconds(GoogleMapsDownloaderV2.DefaultHttpClientTimeoutSeconds);
|
||||
});
|
||||
services.AddSingleton<ISatelliteDownloader, GoogleMapsDownloaderV2>();
|
||||
services.AddSingleton<ITileService, TileService>();
|
||||
return services;
|
||||
|
||||
Reference in New Issue
Block a user