[wp-trac] [WordPress Trac] #15148: Cron Storage Abstraction

WordPress Trac noreply at wordpress.org
Sat Jul 16 07:08:29 UTC 2016


#15148: Cron Storage Abstraction
------------------------------------+-----------------------------
 Reporter:  ryan                    |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Cron API                |     Version:
 Severity:  critical                |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+-----------------------------

Comment (by archon810):

 Here's something crazy to figure out. According to
 https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-
 includes/cron.php#L0 and
 https://codex.wordpress.org/Function_Reference/wp_schedule_single_event,
 wp_schedule_single_event() actually does this: "Don't schedule a duplicate
 if there's already an identical event due within 10 minutes of it" by
 using this code:

 {{{#!php
 <?php
 $next = wp_next_scheduled($hook, $args);
 if ( $next && abs( $next - $timestamp ) <= 10 * MINUTE_IN_SECONDS ) {
     return false;
 }
 }}}


 However, this check doesn't seem to work 100% of the time for some reason.
 This fact explains why you don't see such reports every hour of every day,
 and why most of the time, I suppose, you won't see duplicates in cron.

 Yet I was watching ours go up every time I refreshed Crontrol until the
 proposed (more bulletproof) PR #114.

 I suspect there's some sort of a race condition on busy sites, or some
 time comparison issue (maybe related to time zones). Does anyone have any
 ideas?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/15148#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list