Skip to content

Commit f0bf395

Browse files
authored
Prevent memory leak (#430)
1 parent a494fe0 commit f0bf395

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Commands/WorkCommand.php

+12
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,23 @@ public function handle(
5555
$lastTrimmedStorageAt = $now;
5656
}
5757

58+
$this->ensureTelescopeEntriesAreCollected();
59+
5860
if ($this->option('stop-when-empty')) {
5961
return self::SUCCESS;
6062
}
6163

6264
Sleep::for(1)->second();
6365
}
6466
}
67+
68+
/**
69+
* Schedule Telescope to store entries if enabled.
70+
*/
71+
protected function ensureTelescopeEntriesAreCollected(): void
72+
{
73+
if ($this->laravel->bound(\Laravel\Telescope\Contracts\EntriesRepository::class)) {
74+
\Laravel\Telescope\Telescope::store($this->laravel->make(\Laravel\Telescope\Contracts\EntriesRepository::class));
75+
}
76+
}
6577
}

0 commit comments

Comments
 (0)