Add "404 lifetime" to module to help with performance tuning

Created on 7 May 2025, 8 days ago

Problem/Motivation

-The current code deletes the HTML file every cache clear or cron run.
-Some sites will run cron quite frequently, resulting in the 404 page being thrown out a lot more often than necessary.

Steps to reproduce

-View a 404 page, you get a generated 404.html page, nice job module!
-Trigger cron. 404.html page goes away. Wow that was fast...

Proposed resolution

-Add a config page with a cache lifetime setting.
-Break HTML delete code into it's own function.
-Cache clear will now call delete function directly instead of the hook cron function.
-Hook cron will now only delete 404html if lastRunTime + cacheLifetime <= NOW

Remaining tasks

User interface changes

API changes

Data model changes

-Add config for cache lifetime.
-Stash somewhere smaht lastRunTime

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jnicola

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

Comments & Activities

  • Issue created by @jnicola
  • πŸ‡ΊπŸ‡ΈUnited States jnicola

    Here's my patch on some initial work.

    Cache clear always deletes
    Cron checks against state of when 404 was last generated
    Standardized some calls to strings and such to keep code DRY

  • πŸ‡ΊπŸ‡ΈUnited States pookmish

    @jnicola, The patch no longer applies after the merge of the meta tag change. Can you please move this change into a MR. It will be easier for review and any feedback that might be needed.

  • πŸ‡ΊπŸ‡ΈUnited States jnicola

    I'll try and get that out here soon!

Production build 0.71.5 2024