Commit 74a7e068 authored by Erick Hitter's avatar Erick Hitter Committed by GitHub
Browse files

Merge pull request #77 from Automattic/76/internal-event-locks

Check the event-level lock first, ensuring Internal Events are locked at only the event level
parents 8c41f475 5337e4ab
......@@ -293,7 +293,12 @@ class Events extends Singleton {
* @return bool
*/
private function can_run_event( $event ) {
// Internal Events always run
// Limit to one concurrent execution of a specific action
if ( ! Lock::check_lock( $this->get_lock_key_for_event_action( $event ), 1, JOB_LOCK_EXPIRY_IN_MINUTES * \MINUTE_IN_SECONDS ) ) {
return false;
}
// Internal Events aren't subject to the global lock
if ( is_internal_event( $event['action'] ) ) {
return true;
}
......@@ -303,11 +308,6 @@ class Events extends Singleton {
return false;
}
// Limit to one concurrent execution of a specific action
if ( ! Lock::check_lock( $this->get_lock_key_for_event_action( $event ), 1, JOB_LOCK_EXPIRY_IN_MINUTES * \MINUTE_IN_SECONDS ) ) {
return false;
}
// Let's go!
return true;
}
......
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