[wp-hackers] Dealing with WP cron's raciness

Paul Menard paul at codehooligans.com
Thu Sep 19 13:34:48 UTC 2013

On Sep 19, 2013, at 9:19 AM, Dion Hulse (dd32) <wordpress at dd32.id.au> wrote:

> It should also be noted, that if you have a long-running job (like some
> backup plugins), and you have a server where someone triggers wp-cron.php
> manually with a real cron every 1/2/5minutes, then you'll most likely get
> duplicate events running.. simply because your event is only de-queued
> AFTER it's run, so if it takes 5 minutes to run, and another request it
> made 2 minutes into that window, you'll get two jobs

Just my thoughts. This is really no different than dealing directly with UNIX cron calling shell scripts. If you know there is potential that another process will start before the previous process finishes you implement a locking system of your own design. OR as been illustrated in this thread you have users who setup UNIX crontabs to call wp-cron.php every 2 minutes. Things you just cannot control. 

I would not personally like to see this added to WordPress core. I actually have reasons in the past to rely on the multi-instance cron processing for some sampling plugins I wrote. Each instance needed to be independent. I don't want WP to be the traffic cop. 

More information about the wp-hackers mailing list