Don't preload if it's a development envrionment
This commit is contained in:
parent
14f8ea618a
commit
01ccc1ab91
|
|
@ -9,22 +9,26 @@ namespace AS1024.GeoFeed.GeoFeedBuilder
|
|||
private readonly ILogger<PreLoadGeoFeed> logger;
|
||||
private readonly IGeoFeedProvider provider;
|
||||
private readonly IMemoryCache memoryCache;
|
||||
private readonly IWebHostEnvironment environment;
|
||||
private const string GeoFeedCacheKey = "GeoFeedData";
|
||||
|
||||
public PreLoadGeoFeed(ILogger<PreLoadGeoFeed> logger,
|
||||
IGeoFeedProvider provider,
|
||||
IMemoryCache memoryCache)
|
||||
IMemoryCache memoryCache,
|
||||
IWebHostEnvironment environment)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.provider = provider;
|
||||
this.memoryCache = memoryCache;
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
async Task IHostedService.StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
await StartPreLoad();
|
||||
if (environment.IsProduction())
|
||||
await StartPreLoad();
|
||||
} catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning($"Failed to preload, exception settings below:\n{ex}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue