[wp-hackers] Can Multiple Simultaneous Cron Instances Be Called ?

Casey Bisson casey.bisson at gmail.com
Tue Dec 7 04:49:09 UTC 2010


I struggled with simultaneous execution problems a bit. One solution, I believe, is to use actual unix cron to trigger wp cron, but I turned to mysql named locks. They're quicker to set than a table update and automatically reset after the connection that created them is dropped. 

Usage example in one of my plugins here:

http://plugins.trac.wordpress.org/browser/bsuite/trunk/bsuite.php#L2276

--Casey

http://MaisonBisson.com

On Dec 6, 2010, at 7:55 PM, Otto <otto at ottodestruct.com> wrote:

> In an extremely unlikely case, yes. There is a bit of a race condition
> here. But it's tiny. The spawn_cron() function sets a transient called
> doing_cron which it also checks for. Thus, if two hits launched at
> almost the same moment, one of them will set the doing_cron transient
> first, blocking the other one from continuing. The window for two to
> run at once and both succeed is about as small as possible.
> 
> -Otto
> 
> 
> 
> On Mon, Dec 6, 2010 at 8:53 PM, Raj <lists at krusible.com> wrote:
>> WordPress API's cron feature uses the website traffic to trigger scheduled
>> tasks. Is it possible that multiple instances of cron be triggered
>> simultaneously in a very high trafficked website because all the cron checks
>> pass at the same time?
>> 
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list