diff --git a/src/Concerns/ProvidesDefaultConfigurationOptions.php b/src/Concerns/ProvidesDefaultConfigurationOptions.php index d0590c46e..0eb049196 100644 --- a/src/Concerns/ProvidesDefaultConfigurationOptions.php +++ b/src/Concerns/ProvidesDefaultConfigurationOptions.php @@ -47,6 +47,7 @@ public static function prepareApplicationForNextOperation(): array \Laravel\Octane\Listeners\GiveNewApplicationInstanceToViewFactory::class, \Laravel\Octane\Listeners\FlushDatabaseRecordModificationState::class, \Laravel\Octane\Listeners\FlushDatabaseQueryLog::class, + \Laravel\Octane\Listeners\RefreshQueryDurationHandling::class, \Laravel\Octane\Listeners\FlushLogContext::class, \Laravel\Octane\Listeners\FlushArrayCache::class, \Laravel\Octane\Listeners\FlushMonologState::class, diff --git a/src/Listeners/RefreshQueryDurationHandling.php b/src/Listeners/RefreshQueryDurationHandling.php new file mode 100644 index 000000000..78f98427d --- /dev/null +++ b/src/Listeners/RefreshQueryDurationHandling.php @@ -0,0 +1,29 @@ +sandbox->resolved('db')) { + return; + } + + foreach ($event->sandbox->make('db')->getConnections() as $connection) { + if ( + method_exists($connection, 'resetTotalQueryDuration') + && method_exists($connection, 'allowQueryDurationHandlersToRunAgain') + ) { + $connection->resetTotalQueryDuration(); + $connection->allowQueryDurationHandlersToRunAgain(); + } + } + } +}