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:
ryan 2008-10-15 06:00:42 +00:00
parent 0b2c0cf5ba
commit 7ae1291c12
1 changed files with 5 additions and 0 deletions

View File

@ -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 );