From 17a19d056bf3d244e95c80086eacf8762433ee53 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 6 Feb 2009 22:25:35 +0000 Subject: [PATCH] Use transient for doing_cron. see #9048 git-svn-id: https://develop.svn.wordpress.org/trunk@10519 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-cron.php | 4 ++-- wp-includes/cron.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-cron.php b/wp-cron.php index de4050d5bf..20a7e05490 100644 --- a/wp-cron.php +++ b/wp-cron.php @@ -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(); diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 1f72e4f7f2..cd82ae4ee4 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -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'); }