Skip to content

Commit

Permalink
Enable general benchmarking for filters.
Browse files Browse the repository at this point in the history
Fix copy paste.
  • Loading branch information
Alex Schmitz committed Jul 11, 2021
1 parent 9ceb5e3 commit 0680f4f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache
{
$routeFilter = $this->tryToRouteIt($routes);

// Run "before" filters
// Start up the filters
$filters = Services::filters();

// If any filters were specified within the routes file,
Expand All @@ -388,7 +388,10 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache

// Never run filters when running through Spark cli
if (! defined('SPARKED')) {
// Run "before" filters
$this->benchmark->start('before_filters');
$possibleResponse = $filters->run($uri, 'before');
$this->benchmark->stop('before_filters');

// If a ResponseInterface instance is returned then send it back to the client and stop
if ($possibleResponse instanceof ResponseInterface) {
Expand Down Expand Up @@ -427,8 +430,11 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache
// Never run filters when running through Spark cli
if (! defined('SPARKED')) {
$filters->setResponse($this->response);

// Run "after" filters
$this->benchmark->start('after_filters');
$response = $filters->run($uri, 'after');
$this->benchmark->stop('after_filters');
} else {
$response = $this->response;

Expand Down

0 comments on commit 0680f4f

Please sign in to comment.