Make WordPress Core

Opened 3 years ago

Closed 9 months ago

#49866 closed enhancement (duplicate)

Create pre and post actions for wp-cron jobs

Reported by: nishisan's profile nishisan Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.4
Component: Cron API Keywords: has-patch needs-testing
Focuses: performance Cc:


Some times its dificult to track jobs that impacts in server and db performance within wp-cron. This patch, creates two new hooks: pre_wp_cron_run and post_wp_cron_run.

Eventually a plugin development to track jobs can easily be implemented:

Bellow a conceptual log file from the conceptual plugin

09-04-2020 20:28:00.254607 - [DEBUG] - Cron Job Activated: [action_scheduler_run_queue] 2fa91486-91ce-4678-a2e1-4bff02340952
09-04-2020 20:28:00.294418 - [DEBUG] - Cron Job Terminated: [action_scheduler_run_queue] 2fa91486-91ce-4678-a2e1-4bff02340952

Attachments (1)

wp-cron.php.patch (1.3 KB) - added by nishisan 3 years ago.
wp-cron.php Patch for new hooks

Download all attachments as: .zip

Change History (2)

3 years ago

wp-cron.php Patch for new hooks

#1 @iandunn
9 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hey, thanks for the patch! This looks like a duplicate of #28635, and related to #18471. It'd be great to join on those conversations and integrate the ideas here.

If there's something unique about this ticket, though, we can always reopen.

Note: See TracTickets for help on using tickets.