Use microtime() for cron locks. fixes #19700

git-svn-id: http://svn.automattic.com/wordpress/trunk@19722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2012-01-09 19:02:31 +00:00
parent 05c31605c7
commit 2f915b5320
2 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ if ( false === $crons = _get_cron_array() )
die();
$keys = array_keys( $crons );
$local_time = time();
$local_time = microtime( true );
if ( isset($keys[0]) && $keys[0] > $local_time )
die();
@ -61,7 +61,7 @@ if ( empty( $doing_wp_cron ) ) {
// Called from external script/job. Try setting a lock.
if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $local_time ) )
return;
$doing_cron_transient = $doing_wp_cron = time();
$doing_cron_transient = $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
set_transient( 'doing_cron', $doing_wp_cron );
} else {
$doing_wp_cron = $_GET[ 'doing_wp_cron' ];

View File

@ -194,8 +194,8 @@ function wp_next_scheduled( $hook, $args = array() ) {
*/
function spawn_cron( $local_time = 0 ) {
if ( !$local_time )
$local_time = time();
if ( ! $local_time )
$local_time = microtime( true );
if ( defined('DOING_CRON') || isset($_GET['doing_wp_cron']) )
return;
@ -226,7 +226,7 @@ function spawn_cron( $local_time = 0 ) {
if ( !empty($_POST) || defined('DOING_AJAX') )
return;
$doing_wp_cron = $local_time;
$doing_wp_cron = sprintf( '%.22F', $local_time );
set_transient( 'doing_cron', $doing_wp_cron );
ob_start();
@ -241,7 +241,7 @@ function spawn_cron( $local_time = 0 ) {
return;
}
$doing_wp_cron = $local_time;
$doing_wp_cron = sprintf( '%.22F', $local_time );
set_transient( 'doing_cron', $doing_wp_cron );
$cron_url = get_option( 'siteurl' ) . '/wp-cron.php?doing_wp_cron=' . $doing_wp_cron;
@ -264,7 +264,7 @@ function wp_cron() {
if ( false === $crons = _get_cron_array() )
return;
$local_time = time();
$local_time = microtime( true );
$keys = array_keys( $crons );
if ( isset($keys[0]) && $keys[0] > $local_time )
return;