Fix queue code to use CiviCRM's version of what the time is, instead of server's.
authorRich Lott / Artful Robot <forums@artfulrobot.uk>
Tue, 8 Oct 2019 05:53:05 +0000 (06:53 +0100)
committerRich Lott / Artful Robot <forums@artfulrobot.uk>
Tue, 8 Oct 2019 05:53:05 +0000 (06:53 +0100)
CRM/Queue/Queue/Sql.php

index 90bad01cbd98c018137fda6a906797b344386074..28f13506de65ccdb4fcf702506fc635eda026b84 100644 (file)
@@ -137,10 +137,11 @@ class CRM_Queue_Queue_Sql extends CRM_Queue_Queue {
           ORDER BY weight ASC, id ASC
           LIMIT 1
         ) first_in_queue
-        WHERE release_time IS NULL OR release_time < NOW()
+        WHERE release_time IS NULL OR release_time < %2
       ";
     $params = [
       1 => [$this->getName(), 'String'],
+      2 => [CRM_Utils_Time::getTime(), 'Timestamp'],
     ];
     $dao = CRM_Core_DAO::executeQuery($sql, $params, TRUE, 'CRM_Queue_DAO_QueueItem');
     if (is_a($dao, 'DB_Error')) {