DJJob.php
public function start() {
        $this->log("[JOB] Starting worker {$this->name} on queue::{$this->queue}", self::INFO);

        $count = 0;
        $job_count = 0;
        try {
            while ($this->count == 0 || $count < $this->count) {
                if (function_exists("pcntl_signal_dispatch")) pcntl_signal_dispatch();

                $count += 1;
                $job = $this->getNewJob($this->queue);

                if (!$job) {
                    $this->log("[JOB] Failed to get a job, queue::{$this->queue} may be empty", self::DEBUG);
                    sleep($this->sleep);
                    continue;
                }

                $job_count += 1;
                $job->run();
            }
        } catch (Exception $e) {
            $this->log("[JOB] unhandled exception::\"{$e->getMessage()}\"", self::ERROR);
        }

        $this->log("[JOB] worker shutting down after running {$job_count} jobs, over {$count} polling iterations", self::INFO);
    }
public function start() {
        $this->log("[JOB] Starting worker {$this->name} on queue::{$this->queue}", self::INFO);

        $count = 0;
        $job_count = 0;
        try {
            while ($this->count == 0 || $count < $this->count) {
                if (function_exists("pcntl_signal_dispatch")) pcntl_signal_dispatch();

                $count += 1;
                $job = $this->getNewJob($this->queue);

                if (!$job) {
                    $this->log("[JOB] Failed to get a job, queue::{$this->queue} may be empty", self::DEBUG);
                    sleep($this->sleep);
                    continue;
                }

                $job_count += 1;
                $job->run();
            }
        } catch (Exception $e) {
            $this->log("[JOB] unhandled exception::\"{$e->getMessage()}\"", self::ERROR);
        }

        $this->log("[JOB] worker shutting down after running {$job_count} jobs, over {$count} polling iterations", self::INFO);
    }
public function start ( ) { $ this -> log ( "[JOB] Starting worker {$this->name} on queue::{$this->queue}" , self :: INFO ) ; $ count = 0 ; $ job_count = 0 ; try { while ( $ this -> count == 0 || $ count < $ this -> count ) { if ( function_exists ( "pcntl_signal_dispatch" ) ) pcntl_signal_dispatch ( ) ; $ count += 1 ; $ job = $ this -> getNewJob ( $ this -> queue ) ; if ( ! $ job ) { $ this -> log ( "[JOB] Failed to get a job, queue::{$this->queue} may be empty" , self :: DEBUG ) ; sleep ( $ this -> sleep ) ; continue ; } $ job_count += 1 ; $ job -> run ( ) ; } } catch ( Exception $ e ) { $ this -> log ( "[JOB] unhandled exception::\"{$e->getMessage()}\"" , self :: ERROR ) ; } $ this -> log ( "[JOB] worker shutting down after running {$job_count} jobs, over {$count} polling iterations" , self :: INFO ) ; }
Starts the worker process.
Starts the worker process .