private function can_run_event($event)
{
// 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;
}
// 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;
}
// Let's go!
return true;
}