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

commented Feb 3, 2016

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

Add a timer to individual events in `wp cron event run`
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
Merge pull request #2437 from wp-cli/2434-cron-timer
Add a timer to individual events in `wp cron event run`

@danielbachhuber danielbachhuber merged commit 935afb8 into master Feb 3, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@danielbachhuber danielbachhuber deleted the 2434-cron-timer branch Feb 3, 2016

@fjarrett

This comment has been minimized.

Copy link
Contributor

commented Feb 3, 2016

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 ) );

This comment has been minimized.

Copy link
@fjarrett

fjarrett Feb 3, 2016

Contributor

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
2 participants
You can’t perform that action at this time.