Commit 8f9b27dc authored by Erick Hitter's avatar Erick Hitter
Browse files

Review feedback: loop improvements

parent b8e3fd23
......@@ -141,7 +141,7 @@ class Events_Store extends Singleton {
$jobs_posts = $this->get_jobs( array(
'status' => self::STATUS_PENDING,
'quantity' => $quantity,
'page' => $page,
'page' => $page++,
) );
// Nothing more to add
......@@ -149,8 +149,6 @@ class Events_Store extends Singleton {
break;
}
$page++;
// Something's probably wrong if a site has more than 1,500 pending cron actions
if ( $page > 15 ) {
do_action( 'a8c_cron_control_stopped_runaway_cron_option_rebuild' );
......@@ -184,13 +182,8 @@ class Events_Store extends Singleton {
$cron_array[ $timestamp ][ $action ][ $instance ]['interval'] = $jobs_post->interval;
}
}
// No need to keep looping if there were fewer events than we asked for
if ( count( $jobs_posts ) < $quantity ) {
break;
}
}
} while( true );
} while( count( $jobs_posts ) >= $quantity );
// Re-sort the array just as Core does when events are scheduled
// Ensures events are sorted chronologically
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment