[wp-trac] Re: [WordPress Trac] #9318: wp_reschedule_event peggs CPU
when very old timestamp is passed in as argument
WordPress Trac
wp-trac at lists.automattic.com
Wed Mar 11 19:11:27 GMT 2009
#9318: wp_reschedule_event peggs CPU when very old timestamp is passed in as
argument
----------------------------+-----------------------------------------------
Reporter: natethelen | Owner: anonymous
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: Administration | Version: 2.7
Severity: major | Keywords: wp-cron wp_reschedule_event
----------------------------+-----------------------------------------------
Comment(by natethelen):
Here is the change I made which cleaned up the problem. I replaced:
while ( $timestamp < time() + 1 )
$timestamp += $interval;
with:
$now = time();
if($timestamp >= $now)
$timestamp = $now + $interval;
else
$timestamp = $now + ($interval - (($now - $timestamp) %
$interval));
This keeps the $timestamp in line with the difference from time() just
like incrementing does, but without having to loop
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9318#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list