Verified Commit c3cb7afc authored by Erick Hitter's avatar Erick Hitter
Browse files

Don't deadlock the individual-events lock when the global lock blocks an event

This bug was introduced by 5337e4ab
parent 74a7e068
......@@ -304,7 +304,9 @@ class Events extends Singleton {
}
// Check if any resources are available to execute this job
// If not, the indivdual-event lock must be freed, otherwise it's deadlocked until it times out
if ( ! Lock::check_lock( self::LOCK, JOB_CONCURRENCY_LIMIT ) ) {
$this->reset_event_lock( $event );
return false;
}
......@@ -324,7 +326,18 @@ class Events extends Singleton {
}
// Reset individual event lock
Lock::reset_lock( $this->get_lock_key_for_event_action( $event ), JOB_LOCK_EXPIRY_IN_MINUTES * \MINUTE_IN_SECONDS );
$this->reset_event_lock( $event );
}
/**
* Frees the lock for an individual event
*
* @param $event array Event data
*
* @return bool
*/
private function reset_event_lock( $event ) {
return Lock::reset_lock( $this->get_lock_key_for_event_action( $event ), JOB_LOCK_EXPIRY_IN_MINUTES * \MINUTE_IN_SECONDS );
}
/**
......
Supports Markdown
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