Problem/Motivation
In environment_indicator_get_active() there is:
// 3. Check if the indicator is in the db cache.
if ($cached_env = cache_get('environment_indicator')) {
$env = $cached_env->data;
return environment_indicator_alter_and_cache($env);
}
environment_indicator_alter_and_cache() invokes the alterations of the EI and caches. In this case it means we grab a cache that should always have the alterations set and sets probably the same cache again.
Proposed resolution
Just don't use environment_indicator_alter_and_cache() in this case. Or do the alterations but not cache. I didn't check but imho the alteration and cache set should only be done if a form submit of the EI settings did flush the cache. So a cache get should be enough here.
Original report by Kars-T
Dear all
while profiling my site I stumbled upon a constant cache set by EI. I believe it is unnecessary. To remove it is rather easy and I provided a patch. But what I didn't look up is if the EI Cache is cleared on form submit of a preset. If yes this should work fine. If not the cache is basically never reset.
Cheers
Karsten
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | do_not_always_reset_the-2557837-4.patch | 955 bytes | vzblk |
| environment_indicator-dont_always_reset_cache.patch | 556 bytes | kars-t |
Comments
Comment #2
kars-t commentedComment #3
vzblk commentedThis issue leads to more performance issues further, for example if you use git release in EI then it calls 'git describe --all' for every page and I believe it is definitely unnecessary.
Comment #4
vzblk commentedFixed unnecessary cache_set and added cache_clear_all on form submit
Comment #5
azinck commentedCame looking for this. It does seem crazy to ignore this cache. #4 RTBC
Comment #6
jigariusQuite a pickle. I made a fix in my local and it improved performance to a considerable extent. I think the issue should be treated as an improvement suggestion instead of a feature request (if not a bug).
Comment #7
scottrigby@breft you are right, this actually qualifies as a bug. See Category settings of issues, specifically:
The caching fix in #4 by @vzblk has been running on the edit webs of a number of high-demand production sites for white a while now.
Comment #8
e0ipsoThanks all. As you can see, it's taking me too long to fix issues that the community has already fixed.
I am currently looking for co-maintainers, so if you want to help me take good care of this module please drop me an email using the contact form.
I'll be merging this asap.
Comment #9
e0ipsoMerged.