Dont treat suspending of a queue as erroneous

Created on 5 April 2017, about 7 years ago
Updated 8 September 2023, 9 months ago

Problem/Motivation

When the Drupal cron runner is executing a queue, and if a queue worker throws a \Drupal\Core\Queue\SuspendQueueException, a RfcLogLevel::ERROR level log and backtrace are logged, and potentially recorded to a database of some kind. Throwing a SuspendQueueException exception doesnt needed to be treated so severely. For example in the normal course of business I exceed the quotas of an external API, I need to suspend the queue temporarily. This does not warrant logging an 'error' and backtrace.

Proposed resolution

Log a less severe log entry.
Dont log the exception and backtrace.

Remaining tasks

API changes

Data model changes

Original report

In the related issue you can requeue a single item back to the queue.
There already is functionality to suspend the whole queue by throwing a SuspendQueueException. Downside of this is that a watchdog is written. In my case this is not needed. I just want to stop processing the queue in the current cron-run and try again in the next one.

I'm not sure how to go about fixing this. For now, I've made a custom patch which adds a boolean "preventWatchdog" to the SuspendQueueException and in Cron.php, this is checked. I'll add the patch in the first comment.

Side note: watchdogs/exceptions/etc during cron-runs are being emailed, which results in quite some emails which are perfectly fine. I'd rather have an email when there really is a problem.

πŸ“Œ Task
Status

Fixed

Version

10.1 ✨

Component
CronΒ  β†’

Last updated 29 days ago

No maintainer
Created by

πŸ‡³πŸ‡±Netherlands SpadXIII

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.69.0 2024