Duplicated email message on NOP 4.2

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hi everybody,
we are using a very slow SMTP server and when the messages queue has many messages to sent, seems the the SendEmail Task runs in multiple instances and send the same email many times.
If we increase the interval to 30 minutes the problem is solved. But of course this is not a solution.

Can you tell me if there is any setting, even in versione 4.2, to avoid this overlapping of tasks?
Don't know if helps, but message template are marked as "send immediatly".

Thank you,
Marco
4 years ago
Looking at IsTaskAlreadyRunning method (on Task class) we see that there is not any check to be sure that task is not running. It only check if the Interval is elasped.

if (lastStartUtc.AddSeconds(scheduleTask.Seconds) <= DateTime.UtcNow)
      return false;

Thi is my case: task has not completed yet due to a very slow SMTP and for this reason a new instance of SendMail Task is executed.

Hope this helps,
Bye

------
protected virtual bool IsTaskAlreadyRunning(ScheduleTask scheduleTask)
        {
            //task run for the first time
            if (!scheduleTask.LastStartUtc.HasValue && !scheduleTask.LastEndUtc.HasValue)
                return false;
            var lastStartUtc = scheduleTask.LastStartUtc ?? DateTime.UtcNow;

            //task already finished
            if (scheduleTask.LastEndUtc.HasValue && lastStartUtc < scheduleTask.LastEndUtc)
                return false;

            //task wasn't finished last time
            if (lastStartUtc.AddSeconds(scheduleTask.Seconds) <= DateTime.UtcNow)
                return false;

            return true;
        }
3 years ago
I am having this same issue please help!
1 year ago
Is this problem resolved ?
I am having this same issue in v4.50 too.

How can only allow one task instance to run and wait for completion?
How can IsTaskAlreadyRunning be modified to verify that?
1 year ago
Make sure your issue is not being caused by duplicate message templates
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.