Don't crash the app on startup if we can't preload the GeoFeed

This commit is contained in:
Jeff Leung 2024-01-05 16:20:41 -08:00
parent e49ec42f30
commit 8a18e71a6f
1 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,17 @@ namespace AS1024.GeoFeed.GeoFeedBuilder
}
async Task IHostedService.StartAsync(CancellationToken cancellationToken)
{
try
{
await StartPreLoad();
} catch (Exception ex)
{
logger.LogWarning($"Failed to preload, exception settings below:\n{ex}");
}
}
private async Task StartPreLoad()
{
logger.LogInformation("Preloading GeoFeed data in memory...");
List<Models.IPGeoFeed> feed = await provider.GetGeoFeedData();