don't schedule a duplicate if there's already an identical event due in the next 10 minutes. Props tellyworth. fixes #6966
git-svn-id: http://svn.automattic.com/wordpress/trunk@9181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0b2c0cf5ba
commit
7ae1291c12
|
@ -20,6 +20,11 @@
|
||||||
* @param array $args Optional. Arguments to pass to the hook function.
|
* @param array $args Optional. Arguments to pass to the hook function.
|
||||||
*/
|
*/
|
||||||
function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
|
function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
|
||||||
|
// don't schedule a duplicate if there's already an identical event due in the next 10 minutes
|
||||||
|
$next = wp_next_scheduled($hook, $args);
|
||||||
|
if ( $next && $next <= $timestamp + 600 )
|
||||||
|
return;
|
||||||
|
|
||||||
$crons = _get_cron_array();
|
$crons = _get_cron_array();
|
||||||
$key = md5(serialize($args));
|
$key = md5(serialize($args));
|
||||||
$crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
|
$crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
|
||||||
|
|
Loading…
Reference in New Issue