Command/WorkerTenderCommand.php
public function moreOrLess($total, $available)
    {
        $shouldHaveMoreWorkers = false;
        $shouldHaveLessWorkers = false;
        $minWorkers = $this->input->getOption('min-workers');
        $maxWorkers = $this->input->getOption('max-workers');
        $spareWorkers = $this->input->getOption('spare-workers');
        if ($total < $minWorkers) {
            //too little workers,spawn more please
            $shouldHaveMoreWorkers = true;
            $this->verboseOutput("<info>Too little workers</info>: $total / $minWorkers");
        } elseif (($available < $spareWorkers) && ($total <= $maxWorkers)) {
            //we have not enough spare workers we should spawn some more... unless we have reached the max workers limit
            $shouldHaveMoreWorkers = true;
            $this->verboseOutput("<info>Too little spare workers</info>: $available / $spareWorkers");
        } elseif ($total >= $maxWorkers) {
            //we should have less workers because we somehow ended up over the limit
            $shouldHaveLessWorkers = true;
        } elseif ($available >= $minWorkers + $spareWorkers && !$shouldHaveMoreWorkers) {
            //we have more than enough workers for the amount of work we should probably kill one off.
            $shouldHaveLessWorkers = true;
        }
        return array($shouldHaveLessWorkers, $shouldHaveMoreWorkers);
    }
public function moreOrLess($total, $available)
    {
        $shouldHaveMoreWorkers = false;
        $shouldHaveLessWorkers = false;
        $minWorkers = $this->input->getOption('min-workers');
        $maxWorkers = $this->input->getOption('max-workers');
        $spareWorkers = $this->input->getOption('spare-workers');
        if ($total < $minWorkers) {
            //too little workers,spawn more please
            $shouldHaveMoreWorkers = true;
            $this->verboseOutput("<info>Too little workers</info>: $total / $minWorkers");
        } elseif (($available < $spareWorkers) && ($total <= $maxWorkers)) {
            //we have not enough spare workers we should spawn some more... unless we have reached the max workers limit
            $shouldHaveMoreWorkers = true;
            $this->verboseOutput("<info>Too little spare workers</info>: $available / $spareWorkers");
        } elseif ($total >= $maxWorkers) {
            //we should have less workers because we somehow ended up over the limit
            $shouldHaveLessWorkers = true;
        } elseif ($available >= $minWorkers + $spareWorkers && !$shouldHaveMoreWorkers) {
            //we have more than enough workers for the amount of work we should probably kill one off.
            $shouldHaveLessWorkers = true;
        }
        return array($shouldHaveLessWorkers, $shouldHaveMoreWorkers);
    }
public function moreOrLess ( $ total , $ available ) { $ shouldHaveMoreWorkers = false ; $ shouldHaveLessWorkers = false ; $ minWorkers = $ this -> input -> getOption ( 'min-workers' ) ; $ maxWorkers = $ this -> input -> getOption ( 'max-workers' ) ; $ spareWorkers = $ this -> input -> getOption ( 'spare-workers' ) ; if ( $ total < $ minWorkers ) { //too little workers,spawn more please $ shouldHaveMoreWorkers = true ; $ this -> verboseOutput ( "<info>Too little workers</info>: $total / $minWorkers" ) ; } elseif ( ( $ available < $ spareWorkers ) && ( $ total <= $ maxWorkers ) ) { //we have not enough spare workers we should spawn some more... unless we have reached the max workers limit $ shouldHaveMoreWorkers = true ; $ this -> verboseOutput ( "<info>Too little spare workers</info>: $available / $spareWorkers" ) ; } elseif ( $ total >= $ maxWorkers ) { //we should have less workers because we somehow ended up over the limit $ shouldHaveLessWorkers = true ; } elseif ( $ available >= $ minWorkers + $ spareWorkers && ! $ shouldHaveMoreWorkers ) { //we have more than enough workers for the amount of work we should probably kill one off. $ shouldHaveLessWorkers = true ; } return array ( $ shouldHaveLessWorkers , $ shouldHaveMoreWorkers ) ; }
Returns two booleans if there should be more or less workers

@param integer $total
@param integer $busy
@param integer $available
@return array
Returns two booleans if there should be more or less workers