Use transient for doing_cron. see #9048

git-svn-id: https://develop.svn.wordpress.org/trunk@10519 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-02-06 22:25:35 +00:00
parent b4b4718ba8
commit 17a19d056b
2 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ $crons = _get_cron_array();
$keys = array_keys( $crons );
if (!is_array($crons) || $keys[0] > $local_time) {
update_option('doing_cron', 0);
set_transient('doing_cron', 0);
return;
}
@ -53,7 +53,7 @@ foreach ($crons as $timestamp => $cronhooks) {
}
}
update_option('doing_cron', 0);
set_transient('doing_cron', 0);
die();

View File

@ -184,12 +184,12 @@ function spawn_cron( $local_time ) {
* multiple processes on multiple web servers can run this code concurrently
* try to make this as atomic as possible by setting doing_cron switch
*/
$flag = get_option('doing_cron');
$flag = get_transient('doing_cron');
// clean up potential invalid value resulted from various system chaos
if ( $flag != 0 ) {
if ( $flag > $local_time + 10*60 || $flag < $local_time - 10*60 ) {
update_option('doing_cron', 0);
set_transient('doing_cron', 0);
$flag = 0;
}
}
@ -198,7 +198,7 @@ function spawn_cron( $local_time ) {
if ( $flag > $local_time )
return;
update_option( 'doing_cron', $local_time + 30 );
set_transient( 'doing_cron', $local_time + 30 );
add_action('wp_head', 'spawn_cron_request');
}