Verified Commit 66fe60ee authored by Erick Hitter's avatar Erick Hitter
Browse files

Add CLI command to inspect the new lock

parent e57396de
......@@ -34,6 +34,24 @@ class Lock extends \WP_CLI_Command {
$this->get_reset_lock( $args, $assoc_args, $lock_name, $lock_limit, $lock_description );
}
/**
* Manage the lock that limits concurrent execution of jobs with the same action
*
* @subcommand manage-event-lock
* @synopsis <action> [--reset]
*/
public function manage_event_lock( $args, $assoc_args ) {
if ( empty( $args[0] ) ) {
\WP_CLI::error( sprintf( __( 'Specify an action', 'automattic-cron-control' ) ) );
}
$lock_name = \Automattic\WP\Cron_Control\Events::instance()->get_lock_key_for_event_action( array( 'action' => $args[0], ) );
$lock_limit = 1;
$lock_description = __( "This lock prevents concurrent executions of events with the same action, regardless of the action's arguments.", 'automattic-cron-control' );
$this->get_reset_lock( $args, $assoc_args, $lock_name, $lock_limit, $lock_description );
}
/**
* Retrieve a lock's current value, or reset it
*/
......
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