Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/Commands/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
namespace Laravel\Pulse\Commands;

use Carbon\CarbonImmutable;
use DateInterval;
use DateTimeInterface;
use Illuminate\Console\Command;
use Illuminate\Contracts\Console\Isolatable;
use Illuminate\Support\Sleep;
use Laravel\Pulse\Pulse;
use Laravel\Pulse\Support\CacheStoreResolver;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* @internal
*/
#[AsCommand(name: 'pulse:work')]
class WorkCommand extends Command
class WorkCommand extends Command implements Isolatable
{
/**
* The command's signature.
Expand Down Expand Up @@ -74,4 +79,25 @@
\Laravel\Telescope\Telescope::store($this->laravel->make(\Laravel\Telescope\Contracts\EntriesRepository::class));
}
}
public function isolationLockExpiresAt(): DateTimeInterface|DateInterval
{
return now()->addSeconds(5);
}
/**
* Execute the console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
while ($exitCode = parent::execute($input, $output) && is_numeric($this->option('isolated'))) {
if ($exitCode !== (int) $this->option('isolated'))
break;
sleep(10);

Check failure on line 98 in src/Commands/WorkCommand.php

View workflow job for this annotation

GitHub Actions / tests / Static Analysis

Unreachable statement - code above always terminates.

}
return $exitCode;

Check failure on line 101 in src/Commands/WorkCommand.php

View workflow job for this annotation

GitHub Actions / tests / Static Analysis

Method Laravel\Pulse\Commands\WorkCommand::execute() should return int but returns bool.
}
}
Loading