Unable to use queue_unique on a queue from a module installed before queue_unique

Created on 27 April 2022, almost 3 years ago
Updated 22 March 2023, almost 2 years ago

Problem/Motivation

We are using queue_unique on a queue declared by another contrib module (entity_share_cron) but during installation we get this error:

In ContainerBuilder.php line 1030:
                                                                      
  You have requested a non-existent service "queue_unique.database".  
                                                        

The problem here is that entity_share_cron is installed before queue_unique, so when QueueFactory::get() tries to load the queue, the queue_unique.database service is not available yet.
I think the install order is determined by dependencies (and not by module weight). For a custom module, we can make it depend on queue_unique, but not for contrib modules.

Steps to reproduce

  1. Add both entity_share_cron and queue_unique to core.extension.yml.
  2. Add $settings['queue_service_entity_share_cron_pending'] = 'queue_unique.database'; to settings.php.
  3. Run drush si minimal --existing-config.

Proposed resolution

We worked around the problem by disabling queue_unique.database during install:

use Drupal\Core\Installer\InstallerKernel;

if (!InstallerKernel::installationAttempted()) {
  $settings['queue_service_entity_share_cron_pending'] = 'queue_unique.database';
}

However, the same problem could also happen during config import (if both modules are uninstalled and drush cim tries to install them in the wrong order).

🐛 Bug report
Status

Active

Version

2.2

Component

Code

Created by

🇫🇷France prudloff Lille

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024