Add configuration to exclude some tags from being sent in invalidation request

Created on 18 July 2023, 12 months ago
Updated 8 August 2023, 11 months ago

Problem/Motivation

As a follow up for this issue https://www.drupal.org/project/stackpath/issues/3362134 ✨ Gracefully handle 429 Too Many Requests Fixed . There is already an event to exclude some tags from the request to StackPathAPI, but at the moment it is 3rd party modules' responsibility to subscribe to this event. It would be nice to have a configuration page within this module with configuration setting for tags that should be excluded. And of course there should be event subscriber implemented that will exclude the tags that were chosen in configuration form.

Wildcards support is needed, so for example paragraphs:* setting can exclude all tags that are invalidated for paragraphs. Be aware, that this is just an example, it is always up to the project what tags should be skipped/excluded.

Steps to reproduce

  • Install the module
  • Install the paragraphs module
  • Create content type with paragraph field.
  • Create content with 20 paragraphs
  • Save it and then try to update
  • Observe that in the list of invalidated tags there are at least 20 paragraph related tags + some tags related to menu (in case you have added the menu item from the node form), then also some path alias tags and some more.

Proposed resolution

In reality, in most cases the node:<node_nid> tag is the most important for the given page (created from a node). Most of the times the change made to the paragraph should in any case invalidate the cache tag of its parent. This makes invalidation of paragraph tag on Stackpath side obsolete (again, this heavily depends on the project). This way excluding paragraph tags from request to StackPath API can save some slots and hopefully avoid having 429 Too Many Requests issue. See parent issue.

Remaining tasks

Create configuration form with the list of cache tags to skip with support of wildcards.
Implement event subscriber that will remove the cache tags that match the patterns from configuration.
Create patch or MR.

User interface changes

New configuration page with menu link.

API changes

None.

Data model changes

New configuration object with corresponding schema is needed.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany a.dmitriiev

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @a.dmitriiev
  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 7.4 & MySQL 5.7
    last update 11 months ago
    Waiting for branch to pass
  • @admitriiev opened merge request.
  • Status changed to Needs review 11 months ago
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    I have added the new setting for tags blacklist. The tags from the blacklist will not be sent in Stackpath request. The setting is available in purger configuration form:

    But better use blacklist from setting from "Core tags queuer" (it will be available only when you enable purge_queuer_coretags submodule from purge module), so that the tag is not even added to the queue at all:

    The screenshots were possible to make because there is purge_ui module installed.

Production build 0.69.0 2024