protected function numberOfWorkersPerQueue(Supervisor $supervisor, Collection $timeToClear)
    {
        $timeToClearAll = $timeToClear->sum();

        return $timeToClear->mapWithKeys(function ($timeToClear, $queue) use ($supervisor, $timeToClearAll) {
            return $timeToClearAll > 0 && $supervisor->options->autoScaling()
                    ? [$queue => (($timeToClear / $timeToClearAll) * $supervisor->options->maxProcesses)]
                    : [$queue => $supervisor->options->maxProcesses / count($supervisor->processPools)];
        })->sort();
    }
protected function numberOfWorkersPerQueue(Supervisor $supervisor, Collection $timeToClear)
    {
        $timeToClearAll = $timeToClear->sum();

        return $timeToClear->mapWithKeys(function ($timeToClear, $queue) use ($supervisor, $timeToClearAll) {
            return $timeToClearAll > 0 && $supervisor->options->autoScaling()
                    ? [$queue => (($timeToClear / $timeToClearAll) * $supervisor->options->maxProcesses)]
                    : [$queue => $supervisor->options->maxProcesses / count($supervisor->processPools)];
        })->sort();
    }
protected function numberOfWorkersPerQueue ( Supervisor $ supervisor , Collection $ timeToClear ) { $ timeToClearAll = $ timeToClear -> sum ( ) ; return $ timeToClear -> mapWithKeys ( function ( $ timeToClear , $ queue ) use ( $ supervisor , $ timeToClearAll ) { return $ timeToClearAll > 0 && $ supervisor -> options -> autoScaling ( ) ? [ $ queue => ( ( $ timeToClear / $ timeToClearAll ) * $ supervisor -> options -> maxProcesses ) ] : [ $ queue => $ supervisor -> options -> maxProcesses / count ( $ supervisor -> processPools ) ] ; } ) -> sort ( ) ; }
Get the number of workers needed per queue for proper balance.

@param  \Laravel\Horizon\Supervisor  $supervisor
@param  \Illuminate\Support\Collection  $timeToClear
@return \Illuminate\Support\Collection
Get the number of workers needed per queue for proper balance .