Closed MatteoPiovanelli-Laser closed 1 year ago
Can this be solved together with #8688 or the underlying logic is too different?
They are different/unrelated. This one is at a "higher level", in a sense. These providers should be repeating operations they don't need. The other issue is deeper, and I think it should be handled transparently from whatever modules are doing.
In OC these menus are cached on the page itself, using fragment caching.
We noticed some "repeated" queries when generating some test pages.
As the system has to build menus, if the same menu is configured in more places in the page (e.g. in more than one widget in different zones) some providers will repeat the queries they use to fetch the relevant information. The "culprits" we found so far are:
DefaultMenuProvider
that fetches again the list ofMenuPart
s https://github.com/OrchardCMS/Orchard/blob/610b3c4f53ce9a4bdbe26a5a095bd606bfabc811/src/Orchard.Web/Core/Navigation/Services/DefaultMenuProvider.cs#L9TaxonomyNavigationProvider
that fetches again the list of terms. https://github.com/OrchardCMS/Orchard/blob/610b3c4f53ce9a4bdbe26a5a095bd606bfabc811/src/Orchard.Web/Modules/Orchard.Taxonomies/Navigation/TaxonomyNavigationProvider.cs#L16Both this situations can be fixed easily by memorizing the results of the first pass.
A PR for this is coming.