-
Notifications
You must be signed in to change notification settings - Fork 198
/
Horizon.php
38 lines (33 loc) · 827 Bytes
/
Horizon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace PragmaRX\Health\Checkers;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
class Horizon extends Base
{
/**
* Check resource.
*
* @return \PragmaRX\Health\Support\Result
*/
public function check()
{
return $this->horizonIsRunning()
? $this->makeHealthyResult()
: $this->makeResult(false, $this->target->getErrorMessage());
}
/**
* Check if Horizon is up.
*
* @return bool
*/
protected function horizonIsRunning()
{
if (! $masters = app(MasterSupervisorRepository::class)->all()) {
return false;
}
return collect($masters)->contains(function ($master) {
return $master->status === 'paused';
})
? false
: true;
}
}