Skip to content

Commit

Permalink
[5.x] Throw exception when minProcesses is set to zero (#988)
Browse files Browse the repository at this point in the history
* throw exception when minProcesses is set to zero

* Update ProvisioningPlan.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
themsaid and taylorotwell committed Mar 15, 2021
1 parent 48ce00d commit 0153a31
Showing 1 changed file with 5 additions and 0 deletions.
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) {
throw new Exception("The value of [{$supervisor}.minProcesses] must be greater than 0.");
}

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

return SupervisorOptions::fromArray(
Expand Down

0 comments on commit 0153a31

Please sign in to comment.