Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment option to horizon:status command to allow for liveness check on individual environment #1331

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
13 changes: 10 additions & 3 deletions src/Console/StatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StatusCommand extends Command
*
* @var string
*/
protected $signature = 'horizon:status';
protected $signature = 'horizon:status {--environment= : The environment name}';

/**
* The console command description.
Expand All @@ -29,13 +29,20 @@ class StatusCommand extends Command
*/
public function handle(MasterSupervisorRepository $masterSupervisorRepository)
{
if (! $masters = $masterSupervisorRepository->all()) {
$masters = collect($masterSupervisorRepository->all());
if ($environment = $this->option('environment')) {
$masters->filter(function ($supervisor) use ($environment) {
return $supervisor->environment === $environment;
});
}

if ($masters->isEmpty()) {
$this->error('Horizon is inactive.');

return 1;
}

if (collect($masters)->contains(function ($master) {
if ($masters->contains(function ($master) {
return $master->status === 'paused';
})) {
$this->warn('Horizon is paused.');
Expand Down