Skip to content

Commit

Permalink
fix connection existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
okaufmann committed Nov 8, 2022
1 parent a0e4e1b commit 7f1ee04
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Commands/LaravelHorizonDoctorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 7f1ee04

Please sign in to comment.