From b17f679f38a6b12815108333ea2a757fb2c39362 Mon Sep 17 00:00:00 2001 From: Pavel Vesely Date: Fri, 3 Jul 2020 10:19:12 +0200 Subject: [PATCH] Notification job optimalization --- Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs index 520533d9..93127ff5 100644 --- a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs +++ b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs @@ -38,8 +38,10 @@ namespace Oqtane.Infrastructure List sites = siteRepository.GetSites().ToList(); foreach (Site site in sites) { + List notifications = notificationRepository.GetNotifications(site.SiteId, -1, -1).ToList(); + if (!notifications.Any()) continue; //Nothing to do. + log += "Processing Notifications For Site: " + site.Name + "\n\n"; - // get site settings List sitesettings = settingRepository.GetSettings(EntityNames.Site, site.SiteId).ToList(); Dictionary settings = GetSettings(sitesettings); @@ -61,7 +63,6 @@ namespace Oqtane.Infrastructure // iterate through notifications int sent = 0; - List notifications = notificationRepository.GetNotifications(site.SiteId, -1, -1).ToList(); foreach (Notification notification in notifications) { MailMessage mailMessage = new MailMessage();