From 2878541dbb9c089e707f4593511c3633c48df67b Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 14 Apr 2020 10:31:30 -0500 Subject: [PATCH] formatting --- src/ProcessInspector.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/ProcessInspector.php b/src/ProcessInspector.php index b6fb62a8..4b15faec 100644 --- a/src/ProcessInspector.php +++ b/src/ProcessInspector.php @@ -52,14 +52,18 @@ public function orphaned() } /** - * Get all of the process IDs that Horizon is actively monitoring and that are valid. For master processes "valid" - * means they have child processes (supervisors). For supervisors it means their parent processes (masters) exist. + * Get all of the process IDs that Horizon is actively monitoring and that are valid. + * + * For master processes "valid" means they have child processes (supervisors). + * + * For supervisors "valid" means their parent processes (masters) exist. * * @return array */ public function validMonitoring() { $masters = $this->monitoredMastersWithSupervisors(); + $masterNames = array_flip(Arr::pluck($masters, 'name')); return collect(app(SupervisorRepository::class)->all()) @@ -79,7 +83,7 @@ public function validMonitoring() } /** - * Get data of master processes that have child processes (supervisors) and are monitored by Horizon. + * Get the master processes that have child processes (supervisors) and are monitored by Horizon. * * @return array */ @@ -87,23 +91,18 @@ public function monitoredMastersWithSupervisors() { return collect(app(MasterSupervisorRepository::class)->all())->filter(function ($master) { return ! empty($this->exec->run('pgrep -P '.data_get($master, 'pid'))); - }) - ->values() - ->all(); + })->values()->all(); } /** - * Get IDs of all master Horizon processes that don't have any supervisors. + * Get the IDs of all master Horizon processes that don't have any supervisors. * * @return array */ public function mastersWithoutSupervisors() { - return collect($this->exec->run('pgrep -f [h]orizon$')) - ->filter(function ($pid) { - return empty($this->exec->run('pgrep -P '.$pid)); - }) - ->values() - ->all(); + return collect($this->exec->run('pgrep -f [h]orizon$'))->filter(function ($pid) { + return empty($this->exec->run('pgrep -P '.$pid)); + })->values()->all(); } }