Added waiting for Proper Update URL

This commit is contained in:
saile2204 2023-03-20 19:15:21 +01:00
parent 62001cf83a
commit bbd8676126
2 changed files with 7 additions and 3 deletions

View File

@ -8,6 +8,6 @@ public sealed class SpecterConsoleLoggerConfiguration
public Dictionary<LogLevel, ConsoleColor> LogLevelToColorMap { get; set; } = new() public Dictionary<LogLevel, ConsoleColor> LogLevelToColorMap { get; set; } = new()
{ {
[LogLevel.Information] = ConsoleColor.Green /*[LogLevel.Information] = ConsoleColor.Green*/
}; };
} }

View File

@ -16,7 +16,7 @@ namespace DDNSUpdater.Services;
public class DDNSService : IDDNSService public class DDNSService : IDDNSService
{ {
private List<string> UpdateURLs { get; set; } private List<string>? UpdateURLs { get; set; }
public List<Domain> Domains { get; set; } public List<Domain> Domains { get; set; }
private readonly ILogger<DDNSService> _logger; private readonly ILogger<DDNSService> _logger;
@ -45,7 +45,11 @@ public class DDNSService : IDDNSService
public async void Start() public async void Start()
{ {
_logger.LogInformation("Fetching UpdateURLs"); _logger.LogInformation("Fetching UpdateURLs");
UpdateURLs = await GetUpdateURLs(); while (UpdateURLs == null || UpdateURLs.Count == 0 )
{
UpdateURLs = await GetUpdateURLs();
}
_logger.LogInformation($"Fetched {UpdateURLs.Count} UpdateURLs"); _logger.LogInformation($"Fetched {UpdateURLs.Count} UpdateURLs");
} }