Add support for DelayedRequeueException

Created on 24 December 2024, 4 months ago

Problem/Motivation

DelayedRequeueException facilitates delaying the processing of a single queue item without suspending the entire queue or encountering infinite loops. This exception was added in Drupal 9.1.0.

Proposed resolution

This is how Drush handles this exception:

} catch (DelayedRequeueException $e) {
    // The worker requested the task not be immediately re-queued.
    // - If the queue doesn't support ::delayItem(), we should leave the
    // item's current expiry time alone.
    // - If the queue does support ::delayItem(), we should allow the
    // queue to update the item's expiry using the requested delay.
    if ($queue instanceof DelayableQueueInterface) {
        // This queue can handle a custom delay; use the duration provided
        // by the exception.
        $queue->delayItem($item, $e->getDelay());
    }
}
Feature request
Status

Active

Version

1.2

Component

Code

Created by

🇧🇪Belgium dieterholvoet Brussels

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