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

[5.x] Throw exception when minProcesses is set to zero #988

Merged
merged 2 commits into from
Mar 15, 2021
Merged
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
5 changes: 5 additions & 0 deletions src/ProvisioningPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laravel\Horizon;

use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\HorizonCommandQueue;
Expand Down Expand Up @@ -177,6 +178,10 @@ protected function convert($supervisor, $options)
return [Str::camel($key) => $value];
})->all();

if (isset($options['minProcesses']) && $options['minProcesses'] === 0) {
driesvints marked this conversation as resolved.
Show resolved Hide resolved
throw new Exception("The value of [{$supervisor}.minProcesses] must be greater than 0.");
}

$options['parentId'] = getmypid();

return SupervisorOptions::fromArray(
Expand Down