Use transient for doing_cron. see #9048

git-svn-id: http://svn.automattic.com/wordpress/trunk@10519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-02-06 22:25:35 +00:00
parent 153cc03186
commit 8c7d54a9dc
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');
}