Problem/Motivation
This is a follow-up issue to #3062346: Restore in search feature bundles and menus removed for performance reasons. The caching is set to permanent and one thing that still needs to be done is to add cache tags so that if a new bundle or menu is added, the cache clears. I believe every entity type has a '_list' suffix tag. For example, 'node_list'. Since we're dealing with config entities, I'm not sure if there's a 'node_type_list', etc.
If you have enough bundles that they are being limited, and therefore loaded into the search from JSON, and you add a new one that should appear in the JSON, I believe currently, it would not be added automatically because the cache wouldn't clear.
Proposed resolution
- either add cache tags for the various config entity lists, or use some hook to invalidate the cache when new bundles or menus are added.
Remaining tasks
- find solution and add it.
User interface changes
none
API changes
none
Data model changes
none
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | admin-toolbar-search-cache-tags-3062729-9.patch | 7.37 KB | oknate |
| #9 | 3062729-interdiff--3-9.txt | 595 bytes | oknate |
Comments
Comment #2
oknateHere's a fix and test coverage, as well as a test only patch that demonstrates the issue.
Unfortunately, there's no option to run automated tests against 8.x-2.x branch. I think that needs to be set up within the project configuration.
#3062914: Update project settings to allow testing patches against 8.x-2.x branch
Comment #3
oknateReroll. The patches in #2 were incorrectly diffed against 8.x-1.x instead of 8.x-2.x so they are completely wrong.
These are better.
Comment #4
adriancidI just added the tests
Comment #6
oknateGreat, thanks.
I should maybe add test coverage for the menus in search. But I don't want to hold back the caching fix for test coverage.
Comment #7
adriancidHere you don't use the returned cache tags array, this is an error or we don't need this line?
Comment #8
oknateGood catch. That's why I should probably add test coverage for the menus too. I tested with the bundles.
It should be
$cache_tags = Cache::mergeTags($cache_tags, ['config:menu_list']);Comment #9
oknateHere's an update. I haven't tested the change. I can work on test coverage for the menus tonight.
Comment #11
adriancidthanks @oknate, we need this in the 8.x-1.x branch?
Comment #12
oknateAt this point, no, this doesn't apply to 8.x-1.x.
If you backport #3061837: Limit the number of menus to display in the drop-down admin menu. and #3061853: Do not load more than 10 bundles per entity type, then we'd need this after backporting #3062346: Restore in search feature bundles and menus removed for performance reasons.
I like the performance boost in the 8.x-2.x branch, but until it's configurable and there's an upgrade path, I don't don't think 3061837 and 3061853 should go into 8.x-1.x.
I think a lot of sites depend on those bundle links.