For each cron run, I would like to be able to process only 1 item in my queue using QueueWorker. At the moment it seems to me that Drupal keep processing items until it reaches the time parameter for the queue worker. I want to change this behavior to process 1 queue item at a time regardless of the time param. This is what I have so far:
/**
* Processes Tasks.
*
* @QueueWorker(
* id = "data_provider_queue",
* title = @Translation("task worker: data provider queue"),
* cron = {"time" = 60}
* )
*/
class SomeQueueWorker extends QueueWorkerBase {
/**
* {@inheritdoc}
*/
public function processItem($data) {
// Do something with data.
// This seems to keep getting called for more than
// one item in the queue. How do we change that?
}
}
Is this possible with QueueWorker or should I just process queue items in a cron hook manually?