Skip to content

Commit

Permalink
🐛 fix middleware.in.total multiple times called
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanti committed Sep 14, 2023
1 parent cb9d888 commit e5ee1e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Classes/Middleware/WrapMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
self::$middlewareIn = TimingUtility::stopWatch($this->isKernel ? 'requestHandler' : 'middleware.in', $this->info);

if ($this->isKernel) {
TimingUtility::end('middleware.in.total');
$request->getAttribute('middleware.in.total')?->stop();
}

$response = $this->requestHandler->handle($request);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Middleware/XClassMiddlewareDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
$stop = TimingUtility::stopWatch('bootstrap');
$stop->startTime = $_SERVER["REQUEST_TIME_FLOAT"];
$stop->stop();
TimingUtility::start('middleware.in.total');
$request = $request->withAttribute('middleware.in.total', TimingUtility::stopWatch('middleware.in.total'));
if ($this->tip instanceof WrapMiddleware) {
$this->tip->isFirst();
}
Expand Down

0 comments on commit e5ee1e6

Please sign in to comment.