From cbd4815dc8d0c5b41ccbaed76e3c0f63ac6bd06b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 22 Sep 2023 14:40:55 -0700 Subject: [PATCH] Queue::isActive() - Use the latest value of the setting --- CRM/Queue/Queue.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Queue/Queue.php b/CRM/Queue/Queue.php index 008aeb3d0f..09a654adce 100644 --- a/CRM/Queue/Queue.php +++ b/CRM/Queue/Queue.php @@ -61,9 +61,15 @@ abstract class CRM_Queue_Queue { * @throws \CRM_Core_Exception */ public function isActive(): bool { + // Queues work with concurrent processes. We want to make sure status info is up-to-date (never cached). $status = CRM_Core_DAO::getFieldValue('CRM_Queue_DAO_Queue', $this->_name, 'status', 'name', TRUE); - if ($status === 'active' && \Civi::settings()->get('queue_suspended')) { - $status = 'deferred'; + if ($status === 'active') { + $suspend = CRM_Core_DAO::singleValueQuery('SELECT value FROM civicrm_setting WHERE name = "queue_suspended" AND domain_id = %1', [ + 1 => [CRM_Core_BAO_Domain::getDomain()->id, 'Positive'], + ]); + if (!empty(CRM_Utils_String::unserialize($suspend))) { + $status = 'deferred'; + } } $event = GenericHookEvent::create([ 'status' => &$status, -- 2.25.1