File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ public static function prepareApplicationForNextOperation(): array
4747 \Laravel \Octane \Listeners \GiveNewApplicationInstanceToViewFactory::class,
4848 \Laravel \Octane \Listeners \FlushDatabaseRecordModificationState::class,
4949 \Laravel \Octane \Listeners \FlushDatabaseQueryLog::class,
50+ \Laravel \Octane \Listeners \RefreshQueryDurationHandling::class,
5051 \Laravel \Octane \Listeners \FlushLogContext::class,
5152 \Laravel \Octane \Listeners \FlushArrayCache::class,
5253 \Laravel \Octane \Listeners \FlushMonologState::class,
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Laravel \Octane \Listeners ;
4+
5+ class RefreshQueryDurationHandling
6+ {
7+ /**
8+ * Handle the event.
9+ *
10+ * @param mixed $event
11+ * @return void
12+ */
13+ public function handle ($ event ): void
14+ {
15+ if (! $ event ->sandbox ->resolved ('db ' )) {
16+ return ;
17+ }
18+
19+ foreach ($ event ->sandbox ->make ('db ' )->getConnections () as $ connection ) {
20+ if (
21+ method_exists ($ connection , 'resetTotalQueryDuration ' )
22+ && method_exists ($ connection , 'allowQueryDurationHandlersToRunAgain ' )
23+ ) {
24+ $ connection ->resetTotalQueryDuration ();
25+ $ connection ->allowQueryDurationHandlersToRunAgain ();
26+ }
27+ }
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments