the request terminates, and PHP tries to send any pending email.
If you have other request shortly after (typically within the time period required to send an email ~500ms), then your email still appears as not send in the database, and the other PHP thread will try to send it too. Sending duplicates email.
Suggested fix is to, upon call of sendAllPending(), tag all available emails with a ['spooled_for_sending_at' => time()']
this will be saved on the database immediately, so that other processes don't try to send those, before the date in spooled_for_sending_at is more than x seconds. At which time, the new process will update said date, and try again.
Assuming one does
the request terminates, and PHP tries to send any pending email. If you have other request shortly after (typically within the time period required to send an email ~500ms), then your email still appears as not send in the database, and the other PHP thread will try to send it too. Sending duplicates email.
Suggested fix is to, upon call of
sendAllPending()
, tag all available emails with a['spooled_for_sending_at' => time()']
this will be saved on the database immediately, so that other processes don't try to send those, before the date inspooled_for_sending_at
is more than x seconds. At which time, the new process will update said date, and try again.