[wp-trac] [WordPress Trac] #44818: cron: preventing duplicate events fails when the first event is too far in the past
WordPress Trac
noreply at wordpress.org
Thu Sep 20 06:07:24 UTC 2018
#44818: cron: preventing duplicate events fails when the first event is too far in
the past
-----------------------------+------------------------------
Reporter: bodohugobarwich | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version: 2.7
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
-----------------------------+------------------------------
Description changed by SergeyBiryukov:
Old description:
> the patch submitted in \\
> [https://core.trac.wordpress.org/changeset/29939]\\
> [https://core.trac.wordpress.org/ticket/6966]\\
> fails when the timestamp of the first event is too far in the past,
> perhaps because the cron was not executed.
>
> in src/wp-includes/cron.php :
>
> {{{
> if ( $next && abs( $next - $timestamp ) <= 10 * MINUTE_IN_SECONDS ) {
> return;
> }
>
> }}}
>
> The same Event that has been scheduled in 2016 and was not processed
> since then
> permits that any amount of those Events can be added in 1 second
> interval.
>
> That way the database field "cron" in "wp_options" fills up with
> "do_ping" Events in 1 second interval until no further event can't be
> added due to MySQL packet_size restrictions.
>
>
> {{{
> $ date --date="1970-01-01 + 1464704077 sec" +"%F %T"
> 2016-05-31 15:14:37
>
> $ php -r "echo abs( 1464704077 - time()) . \"\\n\";"
> 69813398
> $ php -r "echo abs( 1464704077 - time()) . \" < \". (10*600) . \"\\n\";"
> 69813460 < 6000
> $ php -r "echo (1464704077 - time()) . \" < \". (10*600) . \"\\n\";"
> -69813728 < 6000
> }}}
New description:
the patch submitted in [29939]/#6966 fails when the timestamp of the first
event is too far in the past, perhaps because the cron was not executed.
in src/wp-includes/cron.php :
{{{
if ( $next && abs( $next - $timestamp ) <= 10 * MINUTE_IN_SECONDS ) {
return;
}
}}}
The same Event that has been scheduled in 2016 and was not processed since
then
permits that any amount of those Events can be added in 1 second interval.
That way the database field "cron" in "wp_options" fills up with "do_ping"
Events in 1 second interval until no further event can't be added due to
MySQL packet_size restrictions.
{{{
$ date --date="1970-01-01 + 1464704077 sec" +"%F %T"
2016-05-31 15:14:37
$ php -r "echo abs( 1464704077 - time()) . \"\\n\";"
69813398
$ php -r "echo abs( 1464704077 - time()) . \" < \". (10*600) . \"\\n\";"
69813460 < 6000
$ php -r "echo (1464704077 - time()) . \" < \". (10*600) . \"\\n\";"
-69813728 < 6000
}}}
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44818#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list