public function work($id=1)
    {
        // Pre-work check
        if (!method_exists($this, 'handleWork'))
            throw new Exception("You need to declare `handleWork()` method in your worker controller.", 500);
        
        // INI setting
        if ($this->debug) {
            error_reporting(-1);
            ini_set('display_errors', 1);
        }
        set_time_limit(0);

        // Start worker
        $startTime = microtime(true);
        $pid = getmypid();
        // Print worker close
        $this->_print("Queue Worker - Create #{$id} (PID: {$pid})");

        // Call customized worker process, stops till catch false by callback return
        while ($this->handleWork($this->_staticWork)) {
            // Sleep if set
            if ($this->workerSleep) {
                sleep($this->workerSleep);
            }
            // Loading insurance
            sleep(0.1);
        }

        // Print worker close
        $costSeconds = number_format(microtime(true) - $startTime, 2, '.', '');
        $this->_print("Queue Worker - Close #{$id} (PID: {$pid}) | cost: {$costSeconds}s");

        return;
    }
public function work($id=1)
    {
        // Pre-work check
        if (!method_exists($this, 'handleWork'))
            throw new Exception("You need to declare `handleWork()` method in your worker controller.", 500);
        
        // INI setting
        if ($this->debug) {
            error_reporting(-1);
            ini_set('display_errors', 1);
        }
        set_time_limit(0);

        // Start worker
        $startTime = microtime(true);
        $pid = getmypid();
        // Print worker close
        $this->_print("Queue Worker - Create #{$id} (PID: {$pid})");

        // Call customized worker process, stops till catch false by callback return
        while ($this->handleWork($this->_staticWork)) {
            // Sleep if set
            if ($this->workerSleep) {
                sleep($this->workerSleep);
            }
            // Loading insurance
            sleep(0.1);
        }

        // Print worker close
        $costSeconds = number_format(microtime(true) - $startTime, 2, '.', '');
        $this->_print("Queue Worker - Close #{$id} (PID: {$pid}) | cost: {$costSeconds}s");

        return;
    }
public function work ( $ id = 1 ) { // Pre-work check if ( ! method_exists ( $ this , 'handleWork' ) ) throw new Exception ( "You need to declare `handleWork()` method in your worker controller." , 500 ) ; // INI setting if ( $ this -> debug ) { error_reporting ( - 1 ) ; ini_set ( 'display_errors' , 1 ) ; } set_time_limit ( 0 ) ; // Start worker $ startTime = microtime ( true ) ; $ pid = getmypid ( ) ; // Print worker close $ this -> _print ( "Queue Worker - Create #{$id} (PID: {$pid})" ) ; // Call customized worker process, stops till catch false by callback return while ( $ this -> handleWork ( $ this -> _staticWork ) ) { // Sleep if set if ( $ this -> workerSleep ) { sleep ( $ this -> workerSleep ) ; } // Loading insurance sleep ( 0.1 ) ; } // Print worker close $ costSeconds = number_format ( microtime ( true ) - $ startTime , 2 , '.' , '' ) ; $ this -> _print ( "Queue Worker - Close #{$id} (PID: {$pid}) | cost: {$costSeconds}s" ) ; return ; }
Action for creating a worker

@param integer $id
@return void
Action for creating a worker