Batch doesn't process items with expired leases

Created on 29 July 2025, about 1 month ago

Problem/Motivation

Batch processing either with ui or drush command doesn't process items with expired leases. This could happen because database queue depends on QueueGarbageCollectionInterface for releasing items. However garbage collection of queues done during the cron (by core cron hook). This creates a window where some items have expired leases making them unavailable for processing with this module.

While there is a "Remove leases" option in the Queue Manager form, it releases all items regardless of whether they are expired or not, so it might not be viable for some cases and adds manual overhead.

Steps to reproduce

  1. Make sure using database queue. Claim an item for one second with drush command. Example: drush eval '\Drupal::queue("sample_queue")->claimItem(1);'
  2. Go to queue manager form and apply batch process option to the queue.
  3. Observe that item with expired lease is not processed.

Proposed resolution

Run garbage collection before or during the batch process. For reference, the drush queue-run command (not to be confused with the drush command provided by this module) runs garbage collection before processing the items.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.2

Component

Code

Created by

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