[wp-hackers] wp_cron - How does it know if it's running?
Scott Kingsley Clark
scott at skcdev.com
Mon Feb 28 02:01:41 UTC 2011
Just noticed in a response from Otto to another topic, the answer to my
second question about how does it know whether it's running or not. Still
unsure whether this covers job overlapping (30 min interval job running for
45 mins, does the second job fire at the 30 min mark?).
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
More information about the wp-hackers
mailing list