Project

General

Profile

Actions

Feature #104393

open

Bad performance ot AfterRequestDispatchedEvent

Added by David Bruchmann about 13 hours ago. Updated about 11 hours ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2024-07-15
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

The `AfterRequestDispatchedEvent` is triggered after the content is completely rendered, even including the view.
If an action of another controller shall be rendered this adds up to the needed time and performance.

Therefore I propose another event, after the controller is resolved:

            $controller = $this->resolveController($request);
            $this->eventDispatcher->dispatch(new AfterControllerResolvedEvent($controller, $request));
            $response = $controller->processRequest($request);

As the code `$controller->processRequest($request)` triggers determination of the action too, the new Event wouldn't cover cases where just another action of the same controller should be dispatched individually, though.
To achieve this the code inside `ActionController::processRequest` had to be changed, so that determining the action would be separated from processing. This would be a deeper change though, but probably better and more reasonable than the proposed event.
When these two steps are separated it would be possible to include an event where controller and action are known already. Just forwarding wouldn't be included as that's done from inside the actions.

            $controller = $this->resolveController($request);
            $action = $this->resolveControllerAction($request);
            $this->eventDispatcher->dispatch(new AfterControllerActionResolvedEvent($controller, $action, $request));
            $response = $controller->processRequest($request);
Actions

Also available in: Atom PDF