[wp-hackers] WP cron and "multi-threading"

Owen Winkler ringmaster at midnightcircus.com
Mon Oct 9 03:39:20 GMT 2006


Robert Deaton wrote:
> I've run into this before in testing and I've thought a lot about the
> best way to handle the race condition. The best I can think of, and I
> think it may work, is in wp-cron.php, we set an option that says "we
> are busy doing the cron" along with some random hash. Then we sleep
> for 500 usecs, and check the value of the option. If the option has
> the same value, we continue. If the option has a different value,
> there was some race condition, and the other thread run, and we die.

I've written up the p-code as part of the plugin.  The idea seems sound, 
and has been working so far.  I'm going to leave it running for a while 
to make sure.

Owen



More information about the wp-hackers mailing list