From 7f1ee04d484f49799e497d7caa47bddf5dfb088f Mon Sep 17 00:00:00 2001 From: Oliver Kaufmann Date: Tue, 8 Nov 2022 13:32:48 +0100 Subject: [PATCH] fix connection existence check --- src/Commands/LaravelHorizonDoctorCommand.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Commands/LaravelHorizonDoctorCommand.php b/src/Commands/LaravelHorizonDoctorCommand.php index e002b8c..03bd8f8 100644 --- a/src/Commands/LaravelHorizonDoctorCommand.php +++ b/src/Commands/LaravelHorizonDoctorCommand.php @@ -42,19 +42,18 @@ protected function checkHorizonConfigs(array $horizonConfigs, array $queueConfig // check if connection of horizon queue is configured in queue config if (! ($queueConfigs[$horizonConfig['connection']] ?? false)) { - $errors[] = "Connection {$horizonConfig['connection']} not found for `{$key}` in config/queue.php"; + $errors[] = "Connection {$horizonConfig['connection']} of Horizon worker `{$key}` does not exist in config/queue.php"; } - $queueConnection = $queueConfigs[$horizonConfig['connection']]; - // check that horizon queue has a timout option if (! isset($horizonConfig['timeout'])) { $errors[] = "You should consider setting the `timeout` option for `{$key}` in config/horizon.php"; } // check that timeout is lower than retry_after - if (isset($horizonConfig['timeout']) && $horizonConfig['timeout'] >= $queueConnection['retry_after']) { - $errors[] = "`timeout` of configured horizon queue `{$key}` ({$horizonConfig['timeout']}) in config/horizon.php should be marginally bigger than the `retry_after` option of the queue connection `{$key}` ({$horizonConfig['timeout']}) set in config/queue.php"; + $queueConnection = $queueConfigs[$horizonConfig['connection']] ?? null; + if ($queueConnection && isset($horizonConfig['timeout']) && $horizonConfig['timeout'] >= $queueConnection['retry_after']) { + $errors[] = "`timeout` of configured Horizon queue `{$key}` ({$horizonConfig['timeout']}) in config/horizon.php should be marginally bigger than the `retry_after` option of the queue connection `{$key}` ({$horizonConfig['timeout']}) set in config/queue.php"; } if ($errors->count()) {