Skip to content

Commit

Permalink
Prevent memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
gdebrauwer committed Dec 12, 2024
1 parent a494fe0 commit c823aa8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Commands/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,23 @@ public function handle(
$lastTrimmedStorageAt = $now;
}

$this->ensureTelescopeEntriesAreCollected();

if ($this->option('stop-when-empty')) {
return self::SUCCESS;
}

Sleep::for(1)->second();
}
}

/**
* Schedule Telescope to store entries if enabled.
*/
protected function ensureTelescopeEntriesAreCollected(): void
{
if ($this->laravel->bound(\Laravel\Telescope\Contracts\EntriesRepository::class)) {
\Laravel\Telescope\Telescope::store($this->laravel->make(\Laravel\Telescope\Contracts\EntriesRepository::class));
}
}
}

0 comments on commit c823aa8

Please sign in to comment.