From f1f0e50098c26cf73206b72a285a5d8c08862ab9 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Sat, 1 Apr 2023 16:22:44 -0700 Subject: [PATCH] Features/discord logging (#18) * Had the wrong flag for rss enabled * Adding more logging for discord. --- Newsbot.Collector.Api/BackgroundJobs.cs | 2 +- Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Newsbot.Collector.Api/BackgroundJobs.cs b/Newsbot.Collector.Api/BackgroundJobs.cs index 23689b3..8f126b3 100644 --- a/Newsbot.Collector.Api/BackgroundJobs.cs +++ b/Newsbot.Collector.Api/BackgroundJobs.cs @@ -14,7 +14,7 @@ public static class BackgroundJobs { ConnectionString = configuration.GetValue(ConfigConst.ConnectionStringDatabase), OpenTelemetry = configuration.GetValue(ConfigConst.ConnectionStringOpenTelemetry), - IsEnabled = configuration.GetValue(ConfigConst.RedditIsEnabled) + IsEnabled = configuration.GetValue(ConfigConst.RssIsEnabled) }), "15 0-23 * * *"); RecurringJob.AddOrUpdate("Discord Alerts", x => diff --git a/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs b/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs index 6ed4827..6aacd2c 100644 --- a/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs +++ b/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs @@ -73,7 +73,7 @@ public class DiscordNotificationJob var sourceDetails = _sources.GetByID(articleDetails.SourceID); if (sourceDetails.ID == Guid.Empty) { - _logger.Error($"{JobName} - Article ({articleDetails.ID}) was linked to a empty Source ID. Removing from the queue"); + _logger.Error($"{JobName} - Article ({articleDetails.ID}) was linked to a empty Source ID. Removing from the queue."); _queue.Delete(request.ID); continue; } @@ -109,8 +109,10 @@ public class DiscordNotificationJob Thread.Sleep(3000); } + _logger.Debug($"{JobName} - Removing {request.ID} from the queue."); _queue.Delete(request.ID); } + _logger.Error($"{JobName} - Loop has been completed."); } public DiscordMessage GenerateDiscordMessage(SourceModel source, ArticlesModel article, IconModel icon)