Problem/Motivation

The Late Runtime Processor processes the purge queue on every request, regardless of whether any content actually changed. On busy sites (or sites hit by bots), this means cache invalidations are attempted on every page load - including anonymous, read-only requests - causing unnecessary overhead. In some cases we even hit the Cloudflare API rate limit because of this.

A common deployment pattern is to pair the Late Runtime Processor with a drush p:queue-work cron job to gradually drain the queue in the background. In this setup, it is desirable to have the processor only run during requests where content was actually changed (i.e. an entity was saved), while leaving the bulk of queue processing to cron. There is currently no way to configure this behavior.

Steps to reproduce

1. Enable purge and purge_processor_lateruntime.
2. Enable the Late Runtime Processor via /admin/config/development/performance/purge.
3. Generate significant queue items and observe that every page request — including anonymous reads — triggers queue processing.

Proposed resolution

Add an opt-in setting "Only process the queue on entity save" to the Late Runtime Processor. When enabled, the processor skips queue
processing unless a content entity (node, media, taxonomy term, user, etc.) was inserted, updated, or deleted during that request.

Remaining tasks

further testing and review

User interface changes

A new checkbox — "Only process the queue on entity save" — appears in the Late Runtime Processor configuration form, accessible via the Purge UI at /admin/config/development/performance/purge.
only process the queue on entity save checkbox

API changes

A new public helper function purge_processor_lateruntime_entity_saved(): bool is introduced in the module file. It returns TRUE if a content entity was saved during the current request.

Data model changes

A new config object purge_processor_lateruntime.settings is introduced with a single key: only_on_entity_save (boolean, default false).

CommentFileSizeAuthor
#3 Screenshot 2026-03-17 at 7.53.52.png40.81 KBpedrop

Issue fork purge-3579637

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pedrop created an issue. See original summary.

pedrop’s picture

Issue summary: View changes
StatusFileSize
new40.81 KB
pedrop’s picture

Issue summary: View changes