Mautic campaigns can send duplicate emails because of replication lag during campaign execution. This issue affects all email sending and should be addressed to prevent duplicates.
### Mautic Series 7.0.x series ### Mautic installed version 7.0.1 ### Way of installing I installed with composer using https://github.com/mautic/recommended-project ### PHP version 8.2.0 ### What browsers are you seeing the problem on? _No response_ ### What happened? With database replication, campaign execution (specifically function `executeOrRescheduleScheduledEvents`) can send duplicate emails due to replication lag. Apart from sending email, this issue also applies to all other campaign execution. - Function `executeOrRescheduleScheduledEvents` calls function `getScheduled` to get contact batch. - The query inside `getScheduled` is finding rows that have `isScheduled` as `true` in table `campaign_lead_event_log`. - After finishing each batch, `isScheduled` of those rows is updated to `false`. - However, when using database replication, reader instances have replication lag. - Reader instances might not update `isScheduled` in time before the new batch is executed. -