[wp-trac] [WordPress Trac] #51716: WP Cron - looses entries

WordPress Trac noreply at wordpress.org
Tue Nov 24 00:41:53 UTC 2020


#51716: WP Cron - looses entries
--------------------------+------------------------------
 Reporter:  Nate1         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Cron API      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+------------------------------

Comment (by Nate1):

 Replying to [comment:5 peterwilsoncc]:
 > @Takahashi_Fumiki reports a similar issue in #51747 although rather than
 scheduling jobs in two processes, the race condition comes from scheduling
 while wp_cron is running.
 >

 I haven't run any tests on it to be 100% sure of the direct instance at
 where it occurs, but appears to be a simple transactional conflict. I
 don't think storing it in a single location is going to have much benefit,
 i.e. I often see a number of tasks

 I'd propose if this was inline with the WordPress way of doing things (I'm
 rather new here), that it gets placed into its own DB table, based on a
 similar table structure to the object.
 This would enable the next event/s to be relatively easily queried. So
 WHERE timetorun <= @TIMESTAMP.
 Parameters could be useful in wp-config.php to limit the number of items
 to run on a given call LIMIT 5.

 Just like this https://www.hostgator.com/help/article/how-to-replace-
 wordpress-cron-with-a-real-cron-job parameters could be used, such as
 removing the cron from being called on subsequent HTTP web calls, rather
 have an option to call the cron directly from the Operating System cron,
 to help make it more inline with the expected definition of cron.
 define('DISABLE_WP_CRON', true);


 - Is there any concerns with doing it in the manner above?
 - Would using wp_options be better than a unique table for any reason?
 - WooCommerce - appears to have its own list of tasks that get run, I
 suppose that should be checked to see how that works, and if different
 better - see if there are any features in that method, that could be used.
 - Are there any other features that could be considered to be added to
 make it better, or more usable for WordPress users?

 I have a fair bit of work on, but would be good to have some feedback then
 will look at designing an improved version and getting something
 submitted. I know Ill benefit from this alot, but would also be good to
 ensure there is nothing else that could be added to benefit everyone.

 Thoughts?

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


More information about the wp-trac mailing list