Warning when the 'allowed_duplicates' is not defined in a plugin

Created on 10 July 2024, 9 months ago

Problem/Motivation

I've noticed warning when running the Commerce Recurring cron but can be in similar other cases:

Warning: Undefined array key "allow_duplicates" in Drupal\advancedqueue\Entity\Queue->prepareJob() (line 163 of modules/contrib/advancedqueue/src/Entity/Queue.php).
Drupal\advancedqueue\Entity\Queue->prepareJob(Object) (Line: 133)
Drupal\advancedqueue\Entity\Queue->enqueueJob(Object) (Line: 118)
Drupal\commerce_recurring\Cron->enqueueOrders(Object) (Line: 61)
Drupal\commerce_recurring\Cron->run() (Line: 33)

Proposed resolution

Maybe we need to improve the Queue:prepareJob() and use some default value for the "allow_duplicates" e.g.:
if (!$job_type_manager->getDefinition($job->getType())['allow_duplicates'] ?? TRUE) {

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine khiminrm

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