Command/WorkerTenderCommand.php
private function handle($key, ChildProcessContainer $child)
    {
        $tube = $this->tube;
        $child->processOutput('child_' . $tube . $key);
        //send unhealthy child processes to bed (kill em off)
        if (!$child->checkHealth()) {
            $child->getReadyForBed();
        }
        //send old children to bed (kill em off)
        $readyStatusses = array(ChildProcessContainer::STATUS_READY, ChildProcessContainer::STATUS_ALIVE);
        if ($child->getAge() >= $this->input->getOption('max-worker-age') &&
            in_array($child->status, $readyStatusses)
        ) {
            $child->bedtime();
        }
        //Kill off processes that have used up too much memory already
        if ($child->getBufferLength() >= $this->input->getOption('max-worker-buffer') &&
            in_array($child->status, $readyStatusses)
        ) {
            $child->bedtime();
        }
        //if the child is dead ,clean up the mess
        if ($child->isDead()) {
            $child->cleanUp();
        }
        //if the child is cleaned up remove the object and clean up some memory
        if ($child->isCleanedUp()) {
            $this->verboseOutput("<info>Unsetting Child</info>: $key");
            unset($this->family[$key]);
            $this->verboseOutput("<info>Children left</info>: " . count($this->family));
        }
    }
private function handle($key, ChildProcessContainer $child)
    {
        $tube = $this->tube;
        $child->processOutput('child_' . $tube . $key);
        //send unhealthy child processes to bed (kill em off)
        if (!$child->checkHealth()) {
            $child->getReadyForBed();
        }
        //send old children to bed (kill em off)
        $readyStatusses = array(ChildProcessContainer::STATUS_READY, ChildProcessContainer::STATUS_ALIVE);
        if ($child->getAge() >= $this->input->getOption('max-worker-age') &&
            in_array($child->status, $readyStatusses)
        ) {
            $child->bedtime();
        }
        //Kill off processes that have used up too much memory already
        if ($child->getBufferLength() >= $this->input->getOption('max-worker-buffer') &&
            in_array($child->status, $readyStatusses)
        ) {
            $child->bedtime();
        }
        //if the child is dead ,clean up the mess
        if ($child->isDead()) {
            $child->cleanUp();
        }
        //if the child is cleaned up remove the object and clean up some memory
        if ($child->isCleanedUp()) {
            $this->verboseOutput("<info>Unsetting Child</info>: $key");
            unset($this->family[$key]);
            $this->verboseOutput("<info>Children left</info>: " . count($this->family));
        }
    }
private function handle ( $ key , ChildProcessContainer $ child ) { $ tube = $ this -> tube ; $ child -> processOutput ( 'child_' . $ tube . $ key ) ; //send unhealthy child processes to bed (kill em off) if ( ! $ child -> checkHealth ( ) ) { $ child -> getReadyForBed ( ) ; } //send old children to bed (kill em off) $ readyStatusses = array ( ChildProcessContainer :: STATUS_READY , ChildProcessContainer :: STATUS_ALIVE ) ; if ( $ child -> getAge ( ) >= $ this -> input -> getOption ( 'max-worker-age' ) && in_array ( $ child -> status , $ readyStatusses ) ) { $ child -> bedtime ( ) ; } //Kill off processes that have used up too much memory already if ( $ child -> getBufferLength ( ) >= $ this -> input -> getOption ( 'max-worker-buffer' ) && in_array ( $ child -> status , $ readyStatusses ) ) { $ child -> bedtime ( ) ; } //if the child is dead ,clean up the mess if ( $ child -> isDead ( ) ) { $ child -> cleanUp ( ) ; } //if the child is cleaned up remove the object and clean up some memory if ( $ child -> isCleanedUp ( ) ) { $ this -> verboseOutput ( "<info>Unsetting Child</info>: $key" ) ; unset ( $ this -> family [ $ key ] ) ; $ this -> verboseOutput ( "<info>Children left</info>: " . count ( $ this -> family ) ) ; } }
Handles all child communication things

@param string $key
@param ChildProcessContainer $child
@return void
Handles all child communication things