You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use wp cron event run --due-now as my production cron. Every 5 minutes. But it's a heavy cron. Sometimes it takes more then 5 minutes. When that happens some events get executed twice. Mostly sending emails.
I would suggest a --no-doubles flag or something like that to prevent the cron from doing hooks twice.
When the flag is set, wp-cli should check for the doing_cron transient like core does. And set it if it's starting. Like core does.
At the start of a cron all tasks are gathered with _get_cron_array, events get deleted once the start. And the remaing cron array is still executed. And still in the DB list So after 5 minutes the new cron get also does a _get_cron_array and will get all events that the first cron also is still handling (and deleting as it goes).
The text was updated successfully, but these errors were encountered:
I think this should even be the default behavior. I wouldn't consider this a breaking change, I'd classify this as a bug: We're diverting from expected Core behavior.
I use
wp cron event run --due-now
as my production cron. Every 5 minutes. But it's a heavy cron. Sometimes it takes more then 5 minutes. When that happens some events get executed twice. Mostly sending emails.I would suggest a
--no-doubles
flag or something like that to prevent the cron from doing hooks twice.When the flag is set, wp-cli should check for the
doing_cron
transient like core does. And set it if it's starting. Like core does.Relevant core code
Why is it doing things twice
At the start of a cron all tasks are gathered with _get_cron_array, events get deleted once the start. And the remaing cron array is still executed. And still in the DB list So after 5 minutes the new cron get also does a _get_cron_array and will get all events that the first cron also is still handling (and deleting as it goes).
The text was updated successfully, but these errors were encountered: