Skip to content

Commit

Permalink
Merge pull request #22326 from totten/master-sqlpara
Browse files Browse the repository at this point in the history
SqlParallel - Enable more tests. Fix compatiblity with `release_time`
  • Loading branch information
colemanw authored Dec 31, 2021
2 parents 6b4125f + 8ec1da4 commit ded7073
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CRM/Queue/Queue/SqlParallel.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ public function claimItem($lease_time = 3600) {
$sql = "SELECT id, queue_name, submit_time, release_time, data
FROM civicrm_queue_item
WHERE queue_name = %1
AND release_time IS NULL
AND (release_time IS NULL OR release_time < %2)
ORDER BY weight ASC, id ASC
LIMIT 1
";
$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')) {
Expand Down
6 changes: 6 additions & 0 deletions tests/phpunit/CRM/Queue/QueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public function getQueueSpecs() {
'name' => 'test-queue',
],
];
$queueSpecs[] = [
[
'type' => 'SqlParallel',
'name' => 'test-queue-sqlparallel',
],
];
return $queueSpecs;
}

Expand Down

0 comments on commit ded7073

Please sign in to comment.