Spawn cron with AJAX request, see #9005
git-svn-id: https://develop.svn.wordpress.org/trunk@10474 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
decf24ecb6
commit
962dc22c5e
@ -180,7 +180,6 @@ function spawn_cron( $local_time ) {
|
|||||||
if ( $timestamp > $local_time )
|
if ( $timestamp > $local_time )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$cron_url = get_option( 'siteurl' ) . '/wp-cron.php';
|
|
||||||
/*
|
/*
|
||||||
* multiple processes on multiple web servers can run this code concurrently
|
* multiple processes on multiple web servers can run this code concurrently
|
||||||
* try to make this as atomic as possible by setting doing_cron switch
|
* try to make this as atomic as possible by setting doing_cron switch
|
||||||
@ -201,7 +200,7 @@ function spawn_cron( $local_time ) {
|
|||||||
|
|
||||||
update_option( 'doing_cron', $local_time + 30 );
|
update_option( 'doing_cron', $local_time + 30 );
|
||||||
|
|
||||||
wp_remote_post($cron_url, array('timeout' => 0.01, 'blocking' => false));
|
add_action('wp_head', 'spawn_cron_request');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -371,4 +370,14 @@ function check_server_timer( $local_time ) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function spawn_cron_request() {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* <![CDATA[ */
|
||||||
|
window.setTimeout(function(){var x;if(window.XMLHttpRequest){x=new XMLHttpRequest();}else{try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};}}if(x){x.open('GET','<?php echo get_option('siteurl'); ?>/wp-cron.php?'+(new Date()).getTime(), true);x.send('');}},10);
|
||||||
|
/* ]]> */
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user