From 45123cac1f7d464d826b2171055aa89b7c3bc720 Mon Sep 17 00:00:00 2001 From: Ryan Boren 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: https://develop.svn.wordpress.org/trunk@9181 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/cron.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/cron.php b/wp-includes/cron.php index cdd11ea172..81c9192f8d 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 );