Updating settings requires a cache clear

Created on 18 August 2025, 5 days ago

Problem/Motivation

Altering one of settings doesn't automatically purge the cache for "bot_blocker.min_versions" and other items. You need to do a full cache clear, which may not be ideal if your site is experiencing a large amount of traffic.

Proposed resolution

When the config form is submitted, automatically clear our cache keys.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bburg Washington, DC

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

Comments & Activities

  • Issue created by @bburg
  • πŸ‡ΊπŸ‡ΈUnited States bburg Washington, DC

    In the meantime, you can clear just the version block settings via drush :

    drush @yoursite.prod php:eval "\$item = \Drupal::cache()->get('bot_blocker.min_versions'); var_dump(\$item ? \$item->data : 'Not found');"

    Clearing the substrings
    drush @yoursite.prod php:eval "\$item = \Drupal::cache()->get('bot_blocker.banned_substrings'); var_dump(\$item ? \$item->data : 'Not found');"

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    Thanks for fixing this, I have seen it in other modules as well. It makes you wonder if saving a settings form should be default rebuild caches, except if it's disabled in the code. On the other hand, it might makes things slow down -- it's a balance :)

  • πŸ‡ΊπŸ‡ΈUnited States bburg Washington, DC

    Well, in this case, I am explicitly caching these settings in an extra layer, which may be unnecessary, I was trying to be certain that we minimize any database reads while dealing with potentially hundreds of bot requests a second. So We just need to explicitly clear that cache item, or update it with new values on form submission.

    It was just something I noticed, because I was dealing with a surge in bots, all using Chrome 134. It seems like a bit of a shift in the behavior we've been seeing in this activity over the prior months.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    Interestingly, I have also seen an increase in traffic recently, rising the last 7-10 days and hitting a maximum yesterday and today, with Load Average hitting 97 on the server! Interestingly, a new trend is emerging: All visits come from a varied range of IP's, so it's impossible to block them by IP. I thought it was a DDOS, because it certainly looks like a DDOS .... I see no pattern in Chrome versions. Could it be that a new generation of multi-IP bots have been released?

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    CPU and traffic last 30 days.

Production build 0.71.5 2024