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".
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;