[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
Mon Oct 1 16:47:10 UTC 2018


#44818: cron: preventing duplicate events fails when the first event is too far in
the past
-------------------------------------------------+-------------------------
 Reporter:  bodohugobarwich                      |       Owner:
                                                 |  peterwilsoncc
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.0
Component:  Cron API                             |     Version:  2.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  refresh                                        |
-------------------------------------------------+-------------------------

Comment (by bodohugobarwich):

 I see your argument about creating a new function.\\
 \\
 But about setting {{{$mintimestamp}}} to {{{0}}} this would make match
 {{{$requested_timestamp}}} against any already scheduled event lesser than
 {{{$maxtimestamp}}}\\
 While the Requirement was that any event can be scheduled if there isn't
 any similar event already scheduled within {{{10 min}}} of it.\\
 \\
 That means that if there was already an event at {{{-5 min}}} an event at
 {{{+6 min}}} should be accepted, but an event at {{{+3 min}}} should be
 rejected.\\
 \\
 I wrote two new test cases for this Use Case and they were checked ok:\\
 {{{
 $ phpunit --debug --group cron
 Starting test 'Tests_Cron::test_duplicate_past_to_future_event'.
 .
 Starting test 'Tests_Cron::test_not_duplicate_past_to_future_event'.
 .
 OK (25 tests, 88 assertions)
 }}}

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


More information about the wp-trac mailing list