Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a timer to individual events in wp cron event run #2437

Merged
merged 1 commit into from
Feb 3, 2016

Conversation

danielbachhuber
Copy link
Member

When running multiple events at once, this makes it easier to see which
are taking a long time.

salty-wordpress ➜  wordpress-develop.dev  wp cron event run --all
Executed the cron event 'wp_update_plugins' in 0.421s.
Executed the cron event 'wp_update_themes' in 0.287s.
Executed the cron event 'wp_version_check' in 1.315s.
Executed the cron event 'update_network_counts' in 0.004s.
Executed the cron event 'wp_scheduled_auto_draft_delete' in 0.004s.
Success: Executed a total of 5 cron event(s).

Fixes #2434

When running multiple events at once, this makes it easier to see which
are taking a long time.

```
salty-wordpress ➜  wordpress-develop.dev  wp cron event run --all
Executed the cron event 'wp_update_plugins' in 0.421s.
Executed the cron event 'wp_update_themes' in 0.287s.
Executed the cron event 'wp_version_check' in 1.315s.
Executed the cron event 'update_network_counts' in 0.004s.
Executed the cron event 'wp_scheduled_auto_draft_delete' in 0.004s.
Success: Executed a total of 5 cron event(s).
```
@danielbachhuber danielbachhuber added this to the 0.23.0 milestone Feb 3, 2016
danielbachhuber added a commit that referenced this pull request Feb 3, 2016
Add a timer to individual events in `wp cron event run`
@danielbachhuber danielbachhuber merged commit 935afb8 into master Feb 3, 2016
@danielbachhuber danielbachhuber deleted the 2434-cron-timer branch February 3, 2016 13:36
@frankiejarrett
Copy link

Beat me to it, thanks 😸

if ( $result ) {
$executed++;
WP_CLI::log( sprintf( "Executed the cron event '%s'.", $event->hook ) );
WP_CLI::log( sprintf( "Executed the cron event '%s' in %ss.", $event->hook, $total ) );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could have used %f here for the time value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants