Problem/Motivation
Currently, system_cron
resets expired items instead of the queue handling itself. This makes writing pluggable queue backends harder as they need a somewhat disconnected cron handler unless they are using a service like SQS which does this itself. This also makes code that processes queue items that want to 'reclaim expired items' prior to processing difficult since we can only work with queues that use the core queue database table.
Proposed resolution
Add a resetItems() method to the interface.
Remaining tasks
User interface changes
None
API changes
D8 queue implementations break but it's an easy to fix break. I think the mongodb queue is the only one existing and that's OK (by chx) to break.
Comment | File | Size | Author |
---|---|---|---|
#8 | 2501647-queue-interface-reset-items.patch | 3.53 KB | Dave Reid |
#4 | 2501647-queue-interface-reset-items-D7-do-not-test.patch | 2.58 KB | Dave Reid |
#2 | 2501647-queue-interface-reset-items.patch | 3.62 KB | Dave Reid |
Comments
Comment #1
Dave ReidComment #2
Dave ReidComment #3
Dave ReidI don't think I'm able to move this code in system_cron() to a Drupal\Core\Queue\Batch::resetItems() method because the batch queue runners are not registered as actual queue plugins.
Comment #4
Dave ReidSame patch for Drupal 7, but with DrupalQueueInterface::resetItems() commented out as to not break any existing queue implementations outside of core.
Comment #5
Dave ReidComment #6
Dave ReidNote that we don't even need to add the method to the interface. We can just use method_exists($queue, 'resetItems') like in the Drupal 7 version of the patch.
Comment #7
Dave ReidComment #8
Dave ReidSwitched to using {@inheritdoc} for resetItems().