Opened 5 years ago
Last modified 6 months ago
#28635 reopened feature request
Add status codes and hooks to wp-cron.php
| Reported by: | 
  
     | 
      Owned by: | 
  
     | 
    
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal | 
| Severity: | normal | Version: | |
| Component: | Cron API | Keywords: | has-patch | 
| Focuses: | Cc: | ||
| PR Number: | 
Description
I've been debugging a site problem which turned out to be one of the cron actions resulting in a memory limit breach, and so PHP did a fatal error in the middle of the cron loop. (It's a high-traffic site so it has DISABLE_WP_CRON with system cron pinging wp-cron.php every minute.) There is currently very little debugging hooks provided in wp-cron.php to help diagnose why and where a scheduled event hook is failing. 
Some ideas for how wp-cron.php could be improved to facilitate debugging (and also to help with general logging): 
- Return a status message pinpointing at which point 
wp-cron.phpexited - Return relevant HTTP status codes
 - Allow 
diebehavior to be overridden, similarly to howwp_die()is used elsewhere - Add hooks before before and after each level in the triple-nested crons loop.
 
Attachments (3)
Change History (7)
    
      
    #2
  
    
        
          
            
 @
            
4 years ago
        
    
  
  
  - Keywords needs-refresh removed
 
The patch has been refreshed against the latest trunk. I've also went through and documented the various parts that had @todo docs in the comments.
I recently submitted a new patch for #18471 but I believe this same ticket is related and accomplishes the task better.
    
      
    #5
  
    
        
          
            
 @
            
10 months ago
        
    
  
  
  - Milestone set to Future Release
 - Status changed from reviewing to reopened
 
This is worth some investigation so I'm reopening this and putting it down for a future release. The Cron component has a bit of a backlog, so I won't give a timeframe for now as it would set a false expectation.
Echo status codes from
wp-cron.php. Use_ajax_wp_die_handlerforDOING_CRONtoo. Introduce filterablewp_cron_exit_handlerwith HTTP status codes. Add hooks for cron loops. Commits:https://github.com/x-team/wordpress-develop/compare/master...d6450f9 PR: https://github.com/x-team/wordpress-develop/pull/21