getDuplicateJobs due to $job->getId() returning an empy string

Created on 19 December 2024, 3 months ago

Problem/Motivation

Queue fails with a database exception

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type integer: "" LINE 4: ...D ("state" IN ('queued', 'processing')) AND ("job_id" <> '') ^: SELECT "aq".* FROM "advancedqueue" "aq" WHERE ("queue_id" = :db_condition_placeholder_0) AND ("fingerprint" = :db_condition_placeholder_1) AND ("state" IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) AND ("job_id" <> :db_condition_placeholder_4); Array ( [:db_condition_placeholder_0] => commerce_recurring [:db_condition_placeholder_1] => 5b4f1b2a60061543e6df899fa4d6afe3 [:db_condition_placeholder_2] => queued [:db_condition_placeholder_3] => processing [:db_condition_placeholder_4] => ) in Drupal\advancedqueue\Plugin\AdvancedQueue\Backend\Database->getDuplicateJobs() (line 219 of /opt/drupal/web/modules/contrib/advancedqueue/src/Plugin/AdvancedQueue/Backend/Database.php).

current code check that job_id is not null, but in my use case it's an empty string that breaks the query so we shall check for that too.

Proposed resolution

is_int($job->getId() );
instead of
$job->getId() !== NULL

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇮🇹Italy xlyz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024