Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 301499

All route enhancers are run on every request

$
0
0

Splitting this out from #2368275: EntityRouteEnhancer and ContentFormControllerSubscriber implicitly depend on too many services which will reduce the dependency chain of the entity route enhancer. Opening this issue to address the issue more systemically, see the discussion there for more background.

Issue summary

Route enhancers are implemented as event listeners and all of them are run on every request. This is unnecessary since each route enhancer will only apply to a subset of routes. This is problematic as all dependencies together with their chain will have to be initialized, even they aren't used

Proposed solution

Proposed by znerol:

Wrap the existing route enhancers / route filters with a lazy version of them. The lazy version has stored for each route which enhancers/filters apply
to them. Based upon that, you just have to initialize the route filters/enhancers which are actually needed.

Api change

A new interface got introduced:

\Drupal\Core\Routing\Enhancer\RouteEnhancerInterface
and
\Drupal\Core\Routing\RouteFilterInterface

Based upon that services can specify themselves as +      - { name: lazy_route_filter }
which will let them not be loaded on every request.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue priorityCritical because of performance
Prioritized changesThe main goal of this issue is performance.
DisruptionNot disruptive, existing code with continue to work as exactly the same as before

Viewing all articles
Browse latest Browse all 301499

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>