Commit ac289625 authored by Nick Daugherty's avatar Nick Daugherty

Handle missing events as success

If an event is missing, it shouldn’t be marked as a failure because
that is a normal condition of a multi-process runner (race condition).

Instead, handle it as a success to prevent errors and alerts

Fixes #150
parent 02fd26cd
......@@ -84,7 +84,13 @@ class Orchestrate_Runner extends \WP_CLI_Command {
$run = \Automattic\WP\Cron_Control\run_event( $timestamp, $action, $instance );
if ( is_wp_error( $run ) ) {
\WP_CLI::error( $run->get_error_message() );
$error_data = $run->get_error_data();
if ( isset( $error_data['status'] ) && 404 === $error_data['status'] ) {
\WP_CLI::success( $run->get_error_message() );
} else {
\WP_CLI::error( $run->get_error_message() );
}
} elseif ( isset( $run['success'] ) && true === $run['success'] ) {
\WP_CLI::success( $run['message'] );
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment