diff --git a/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs b/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs index 6aacd2c..74b0722 100644 --- a/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs +++ b/Newsbot.Collector.Services/Jobs/DiscordNotificationJob.cs @@ -63,9 +63,11 @@ public class DiscordNotificationJob { //collect all the new requests var requests = _queue.List(25); + _logger.Debug($"{JobName} - Collected {requests.Count} items to send"); foreach (var request in requests) { + _logger.Debug($"{JobName} - Processing {request.ID}"); // Get all details on the article in the queue var articleDetails = _article.GetById(request.ArticleID); @@ -78,7 +80,15 @@ public class DiscordNotificationJob continue; } - var sourceIcon = _icons.GetBySourceId(sourceDetails.ID); + var sourceIcon = new IconModel(); + try + { + sourceIcon = _icons.GetBySourceId(sourceDetails.ID); + } + catch + { + _logger.Warning($"{JobName} - Source ID '{sourceDetails.ID}' is missing an icon."); + } // Find all the subscriptions for that source var allSubscriptions = _subs.ListBySourceID(sourceDetails.ID); @@ -112,7 +122,7 @@ public class DiscordNotificationJob _logger.Debug($"{JobName} - Removing {request.ID} from the queue."); _queue.Delete(request.ID); } - _logger.Error($"{JobName} - Loop has been completed."); + _logger.Information($"{JobName} - Loop has been completed."); } public DiscordMessage GenerateDiscordMessage(SourceModel source, ArticlesModel article, IconModel icon)