Features/discord logging (#18)

* Had the wrong flag for rss enabled

* Adding more logging for discord.
This commit is contained in:
James Tombleson 2023-04-01 16:22:44 -07:00 committed by GitHub
parent 1bc9b8d842
commit f1f0e50098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,7 @@ public static class BackgroundJobs
{ {
ConnectionString = configuration.GetValue<string>(ConfigConst.ConnectionStringDatabase), ConnectionString = configuration.GetValue<string>(ConfigConst.ConnectionStringDatabase),
OpenTelemetry = configuration.GetValue<string>(ConfigConst.ConnectionStringOpenTelemetry), OpenTelemetry = configuration.GetValue<string>(ConfigConst.ConnectionStringOpenTelemetry),
IsEnabled = configuration.GetValue<bool>(ConfigConst.RedditIsEnabled) IsEnabled = configuration.GetValue<bool>(ConfigConst.RssIsEnabled)
}), "15 0-23 * * *"); }), "15 0-23 * * *");
RecurringJob.AddOrUpdate<DiscordNotificationJob>("Discord Alerts", x => RecurringJob.AddOrUpdate<DiscordNotificationJob>("Discord Alerts", x =>

View File

@ -73,7 +73,7 @@ public class DiscordNotificationJob
var sourceDetails = _sources.GetByID(articleDetails.SourceID); var sourceDetails = _sources.GetByID(articleDetails.SourceID);
if (sourceDetails.ID == Guid.Empty) 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); _queue.Delete(request.ID);
continue; continue;
} }
@ -109,8 +109,10 @@ public class DiscordNotificationJob
Thread.Sleep(3000); Thread.Sleep(3000);
} }
_logger.Debug($"{JobName} - Removing {request.ID} from the queue.");
_queue.Delete(request.ID); _queue.Delete(request.ID);
} }
_logger.Error($"{JobName} - Loop has been completed.");
} }
public DiscordMessage GenerateDiscordMessage(SourceModel source, ArticlesModel article, IconModel icon) public DiscordMessage GenerateDiscordMessage(SourceModel source, ArticlesModel article, IconModel icon)