From 7ae1291c12ee934ec08b027478a44db22e37e4d9 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 15 Oct 2008 06:00:42 +0000 Subject: [PATCH] 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 --- wp-includes/cron.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/cron.php b/wp-includes/cron.php index cdd11ea17..81c9192f8 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -20,6 +20,11 @@ * @param array $args Optional. Arguments to pass to the hook function. */ 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(); $key = md5(serialize($args)); $crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );