From bbd867612650284a96d9c008b0bba995ae21538b Mon Sep 17 00:00:00 2001 From: saile2204 Date: Mon, 20 Mar 2023 19:15:21 +0100 Subject: [PATCH] Added waiting for Proper Update URL --- DDNSUpdater/Logging/SpecterConsoleLoggerConfiguration.cs | 2 +- DDNSUpdater/Services/DDNSService.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/DDNSUpdater/Logging/SpecterConsoleLoggerConfiguration.cs b/DDNSUpdater/Logging/SpecterConsoleLoggerConfiguration.cs index f77592f..8a544e2 100644 --- a/DDNSUpdater/Logging/SpecterConsoleLoggerConfiguration.cs +++ b/DDNSUpdater/Logging/SpecterConsoleLoggerConfiguration.cs @@ -8,6 +8,6 @@ public sealed class SpecterConsoleLoggerConfiguration public Dictionary LogLevelToColorMap { get; set; } = new() { - [LogLevel.Information] = ConsoleColor.Green + /*[LogLevel.Information] = ConsoleColor.Green*/ }; } \ No newline at end of file diff --git a/DDNSUpdater/Services/DDNSService.cs b/DDNSUpdater/Services/DDNSService.cs index b90142b..e3e6b04 100644 --- a/DDNSUpdater/Services/DDNSService.cs +++ b/DDNSUpdater/Services/DDNSService.cs @@ -16,7 +16,7 @@ namespace DDNSUpdater.Services; public class DDNSService : IDDNSService { - private List UpdateURLs { get; set; } + private List? UpdateURLs { get; set; } public List Domains { get; set; } private readonly ILogger _logger; @@ -45,7 +45,11 @@ public class DDNSService : IDDNSService public async void Start() { _logger.LogInformation("Fetching UpdateURLs"); - UpdateURLs = await GetUpdateURLs(); + while (UpdateURLs == null || UpdateURLs.Count == 0 ) + { + UpdateURLs = await GetUpdateURLs(); + } + _logger.LogInformation($"Fetched {UpdateURLs.Count} UpdateURLs"); }