protected function bootstrap() {

        $function_count = array();

        /**
         * If we have "do_all" workers, start them first
         * do_all workers register all functions
         */
        if (!empty($this->do_all_count) && is_int($this->do_all_count)) {

            for ($x=0;$x<$this->do_all_count;$x++) {
                $this->start_worker();
                /**
                 * Don't start workers too fast. They can overwhelm the
                 * gearmand server and lead to connection timeouts.
                 */
                usleep($this->config['worker_initial_spawn_splay']);
            }

            foreach ($this->functions as $worker => $settings) {
                if (empty($settings["dedicated_only"])) {
                    $function_count[$worker] = $this->do_all_count;
                }
            }

        }

        /**
         * Next we loop the workers and ensure we have enough running
         * for each worker
         */
        foreach ($this->functions as $worker=>$config) {

            /**
             * If we don't have do_all workers, this won't be set, so we need
             * to init it here
             */
            if (empty($function_count[$worker])) {
                $function_count[$worker] = 0;
            }

            while ($function_count[$worker] < $config["count"]) {
                $this->start_worker($worker);
                $function_count[$worker]++;;
                /**
                 * Don't start workers too fast. They can overwhelm the
                 * gearmand server and lead to connection timeouts.
                 */
                usleep($this->config['worker_initial_spawn_splay']);
            }

        }

        /**
         * Set the last code check time to now since we just loaded all the code
         */
        $this->last_check_time = time();

    }
protected function bootstrap() {

        $function_count = array();

        /**
         * If we have "do_all" workers, start them first
         * do_all workers register all functions
         */
        if (!empty($this->do_all_count) && is_int($this->do_all_count)) {

            for ($x=0;$x<$this->do_all_count;$x++) {
                $this->start_worker();
                /**
                 * Don't start workers too fast. They can overwhelm the
                 * gearmand server and lead to connection timeouts.
                 */
                usleep($this->config['worker_initial_spawn_splay']);
            }

            foreach ($this->functions as $worker => $settings) {
                if (empty($settings["dedicated_only"])) {
                    $function_count[$worker] = $this->do_all_count;
                }
            }

        }

        /**
         * Next we loop the workers and ensure we have enough running
         * for each worker
         */
        foreach ($this->functions as $worker=>$config) {

            /**
             * If we don't have do_all workers, this won't be set, so we need
             * to init it here
             */
            if (empty($function_count[$worker])) {
                $function_count[$worker] = 0;
            }

            while ($function_count[$worker] < $config["count"]) {
                $this->start_worker($worker);
                $function_count[$worker]++;;
                /**
                 * Don't start workers too fast. They can overwhelm the
                 * gearmand server and lead to connection timeouts.
                 */
                usleep($this->config['worker_initial_spawn_splay']);
            }

        }

        /**
         * Set the last code check time to now since we just loaded all the code
         */
        $this->last_check_time = time();

    }
protected function bootstrap ( ) { $ function_count = array ( ) ; /**
         * If we have "do_all" workers, start them first
         * do_all workers register all functions
         */ if ( ! empty ( $ this -> do_all_count ) && is_int ( $ this -> do_all_count ) ) { for ( $ x = 0 ; $ x < $ this -> do_all_count ; $ x ++ ) { $ this -> start_worker ( ) ; /**
                 * Don't start workers too fast. They can overwhelm the
                 * gearmand server and lead to connection timeouts.
                 */ usleep ( $ this -> config [ 'worker_initial_spawn_splay' ] ) ; } foreach ( $ this -> functions as $ worker => $ settings ) { if ( empty ( $ settings [ "dedicated_only" ] ) ) { $ function_count [ $ worker ] = $ this -> do_all_count ; } } } /**
         * Next we loop the workers and ensure we have enough running
         * for each worker
         */ foreach ( $ this -> functions as $ worker => $ config ) { /**
             * If we don't have do_all workers, this won't be set, so we need
             * to init it here
             */ if ( empty ( $ function_count [ $ worker ] ) ) { $ function_count [ $ worker ] = 0 ; } while ( $ function_count [ $ worker ] < $ config [ "count" ] ) { $ this -> start_worker ( $ worker ) ; $ function_count [ $ worker ] ++ ; ; /**
                 * Don't start workers too fast. They can overwhelm the
                 * gearmand server and lead to connection timeouts.
                 */ usleep ( $ this -> config [ 'worker_initial_spawn_splay' ] ) ; } } /**
         * Set the last code check time to now since we just loaded all the code
         */ $ this -> last_check_time = time ( ) ; }
Bootstap a set of workers and any vars that need to be set
Bootstap a set of workers and any vars that need to be set