Cronario\Producer::mainLoop PHP Method

mainLoop() protected method

Daemon Main Loop 1) checking if Daemon should finish work (if redis flag is finish then finish loop) 2) updating info about loop and current process 3) Migrate all 'delayed job' to 'ready queue' if time is become 4) Update Manager set with theirs worker balance (create new Managers if needed) 5) Clean Manager if they are finished theirs works 6) loop sleep cause and run again until redis flag is 'start'
protected mainLoop ( )
    protected function mainLoop()
    {
        $sleep = $this->getConfig(self::CONFIG_SLEEP_MAIN_LOOP);
        while ($this->isStateStart()) {
            $this->updateInfo();
            $this->getQueue()->migrate();
            $this->updateManagerSet();
            $this->cleanManagerSet();
            sleep($sleep);
        }
        $this->getLogger()->debug("Daemon loop catch \"STOP\" flag (X)", [__NAMESPACE__]);
        return $this;
    }