From 9846dbb763f730e6bbaf39e764f5300836492fba Mon Sep 17 00:00:00 2001 From: Dmitriy Benyuk Date: Mon, 27 Jan 2025 16:48:56 +0200 Subject: [PATCH] Live Integration error message is too chatty --- ...cweb.Ecommerce.DynamicwebLiveIntegration.csproj | 2 +- .../Logging/Logger.cs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj index 3e01a71..08e555e 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Dynamicweb.Ecommerce.DynamicwebLiveIntegration.csproj @@ -1,6 +1,6 @@  - 10.4.16 + 10.4.17 1.0.0.0 Live Integration Live Integration diff --git a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Logging/Logger.cs b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Logging/Logger.cs index 2bf6ae7..de44294 100644 --- a/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Logging/Logger.cs +++ b/src/Dynamicweb.Ecommerce.DynamicwebLiveIntegration/Logging/Logger.cs @@ -106,7 +106,7 @@ public bool SendMail(string message) // Render Template and set as Body mail.Body = templateInstance.Output(); - // Send mail + // Send mail return EmailHandler.Send(mail); } @@ -288,10 +288,12 @@ private void SendLog(string lastError, bool isLastErrorInLog) } // Get last time when the email was sent - DateTime lastTimeSend = Settings.LastNotificationEmailSent; + DateTime lastTimeSend = Settings.LastNotificationEmailSent; bool emailSent = false; if (lastTimeSend == DateTime.MinValue) { + // used for getting the last errors appeared for the future email + Settings.LastNotificationEmailSent = DateTime.Now; emailSent = SendMail(lastError); } else @@ -299,6 +301,7 @@ private void SendLog(string lastError, bool isLastErrorInLog) // send email if the frequency interval already passed if (DateTime.Now.Subtract(lastTimeSend) >= TimeSpan.FromMinutes((double)frequency)) { + Settings.LastNotificationEmailSent = DateTime.Now; if (!isLastErrorInLog) { emailSent = SendMail(GetLastLogData() + lastError); @@ -313,9 +316,10 @@ private void SendLog(string lastError, bool isLastErrorInLog) if (emailSent) { Log(ErrorLevel.EmailSend, "Send e-mail with errors"); - - // used for getting the last errors appeared for the future email - Settings.LastNotificationEmailSent = DateTime.Now; + } + else + { + Settings.LastNotificationEmailSent = lastTimeSend; } }