Closed vishalpawar-tudip closed 2 years ago
I'd suggest to encapsulate that in a script which ensures only one instance runs at a time like this:
command='php bin/console swiftmailer:spool:send --message-limit=100 --time-limit=20 --env=prod >/dev/null 2>&1'
result=`pgrep -cf "$command"`
if [ "${result}" -eq "0" ] ; then
$command
fi
Thanks for the solution @MisatoTremor .
Any other solution to above issue or any possibility why this is happening?
Any help is really appreciated!!!
It would be fine if bin/console swiftmailer:spool:send
won't start if other instance is executed already. Some .pid file?
I know the are an old post, but you can combine the cron execution with a flock. See here http://manpages.ubuntu.com/manpages/bionic/fr/man1/flock.1.html
Closing as Swiftmailer is not maintained anymore and in any case, the spool feature of Swiftmailer was really weak. Migrating to Symfony Mailer would give a way better way to send emails async.
Hi Team,
I have a CRON Job which sends the emails. It creates about 3000 unique emails to send daily.
I have configured it like below:
*/1 * * * * php bin/console swiftmailer:spool:send --message-limit=100 --time-limit=20 --env=prod >/dev/null 2>&1
And clear failure is set after five minutes.
These simultaneous calls cause the multiple sending of the same email. So today, one user will receive multiple same emails even if I have only one entry in my database.
Please, let us know of any solution.