- Issue created by @ambient.impact
- 🇨🇦Canada ambient.impact Toronto
Kind of related issue in the sense it deals with automatic discovery of hook classes I suppose.
- 🇦🇺Australia dpi Perth, Australia
Per my comments in the linked issue, I think I still want to try to tack on Hux' data onto the container in some way such that if it is invalidated/destroyed then the Hux data is naturally rebuilt. I'd prefer to not make a public API to this. Leaning to close this in favor of the other unless we come to some other agreement.
- 🇦🇺Australia dpi Perth, Australia
The results of discovery aren't supposed to change unless Drupal's extension list changes.
So if you've got optimise=on, then you'll need to do a full system cache clear just like you would if you were introducing a new Hooks class in an already installed module.
If optimise=off then its just being sticky about the container, you're in Kernel tests so some crafty ways of getting around it are needed.
You could try something as simple as using moduleinstaller to install Hux then check if your hooks are available. Anything more than that then I'd say you may be overtesting.
- 🇨🇦Canada ambient.impact Toronto
I think you're right and ideally this should just automagically work. I ended up just implementing the test with Hux already installed and it's good enough for our purposes.
So if you've got optimise=on, then you'll need to do a full system cache clear just like you would if you were introducing a new Hooks class in an already installed module.
In general, I tend to avoid clearing caches in production unless totally necessary, as at least one of my sites has some pretty complex content that can be expensive to render, both in terms of time from a cold cache and also since we have background tasks that warm those caches as needed. We rely on rebuilding specific things or via container rebuilds on deployment rather than nuking the whole cache. I even built and maintain a small contrib module specifically to quickly and easily rebuild everything from the container to library definitions, the router, and so on → .
Is it possible to have the performance benefits of optimized mode, small though they may be, without having to do a full cache clear if new or changed hook classes are introduced? Our container mostly only gets rebuilt on deploy (via the deployment identifier) and very rarely otherwise.
- 🇦🇺Australia dpi Perth, Australia
Is it possible to have the performance benefits of optimized mode, small though they may be, without having to do a full cache clear if new or changed hook classes are introduced?
Yeah, thats where adding this data to the container instead of cache bins comes in.
- Status changed to Closed: won't fix
over 1 year ago 10:39pm 13 November 2023 - 🇨🇦Canada ambient.impact Toronto
Makes sense. Going to close this in favour of the other issue and will help out there if I'm able to. Let me know if there's something specific I can contribute.
- 🇦🇺Australia dpi Perth, Australia
Let me know if there's something specific I can contribute.
Researching an efficient mechanism to store huxdiscovery into the container is the main thing. Help appreciated.