Called when the worker is ready to go.
@return void
498143
public function onReady()
    {
        \PHPDaemon\Clients\IMAP\Pool::getInstance()->open(
            $this->config->host->value,
            $this->config->login->value,
            $this->config->password->value,
            function ($conn) {
                if (!$conn) {
                    $this->log('Fail to open IMAP connection');
                    return;
                }
                $this->log('open IMAP connection success');
                $conn->getRawMessage(
                    function ($conn, $isSuccess, $raw) {
                        $this->log(print_r($raw, true));
                        $conn->logout();
                    },
                    1,
                    false
                );
            },
            true
        );
    }
1113690
public function onWakeup()
    {
        $this->running = true;
        Daemon::$context = $this;
        $_SESSION = &$this->attrs->session;
        $_GET = &$this->attrs->get;
        $_POST = [];
        $_COOKIE = &$this->attrs->cookie;
        Daemon::$process->setState(Daemon::WSTATE_BUSY);
    }
529273
public function process(): void
    {
        $this->queue = msg_get_queue(ftok(__DIR__.DIRECTORY_SEPARATOR.'Queue.php', 't'));
        $this->catchSignal();
        $this->spawnInitialWorkers();
        $this->main();
    }
303346
public function onReady()
    {
        \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute(
            '/sockjs',
            function ($client) {
                return new SimpleRoute($client, $this);
            }
        );
    }
165591
protected function startup()
    {
        $this->getProcess()->setTitle('Starting');
        $this->registerSignalHandlers();

        $this->eventDispatcher->dispatch(
            ResqueWorkerEvents::START_UP,
            new WorkerEvent($this)
        );
    }
72061
public function onWorkerStart($server)
    {
        if ($this->container->config->get('swoole.enable_coroutine', false)) {
            Runtime::enableCoroutine(true);
        }

        $this->clearCache();

        $this->container->event->trigger('swoole.workerStart', func_get_args());

        // don't init app in task workers
        if ($server->taskworker) {
            $this->setProcessName('task process');

            return;
        }

        $this->setProcessName('worker process');

        $this->prepareApplication();

        if ($this->isServerWebsocket) {
            $this->prepareWebsocketHandler();
            $this->loadWebsocketRoutes();
        }
    }
426238
public function onReady()
    {
        $this->createXMLStream();
        $this->startXMLStream();
        $this->keepaliveTimer = setTimeout(function ($timer) {
            $this->ping();
        }, 1e6 * 30);
    }
53947
public function ready()
    {
        if ($this->status !== self::REGISTERED) {
            throw new \LogicException('Cannot ready a slave that is not in registered state');
        }

        $this->status = self::READY;
    }
1164521
public function onShutdown()
    {
        $error = error_get_last();
        if ($error === null) {
            return;
        }
        if (($error['type'] & error_reporting()) === 0) {
            return;
        }
        if ($this->lastError !== null &&
            $error['message'] === $this->lastError['message'] &&
            $error['file'] === $this->lastError['file'] &&
            $error['line'] === $this->lastError['line']) {
            return;
        }
        $trace = [[
            'file' => $error['file'],
            'line' => $error['line'],
        ]];
        $exc = new Errors\Fatal($error['message'], $trace);
        $this->notifier->notify($exc);
    }
1128359
public function onReady()
    {
        $this->setWatermark(2, $this->pool->maxAllowedPacket);
        Crypt::randomString(16, null, function ($string) {
            $this->key = base64_encode($string);
            $this->write('GET /' . $this->path . " HTTP/1.1\r\nHost: " . $this->host . ($this->port != 80 ? ':' . $this->port : '') . "\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: " . $this->key . "\r\nSec-WebSocket-Version: 13\r\n\r\n");
        });
    }
1138724
public function onReady()
    {
        parent::onReady();
        $this->setWatermark(null, $this->pool->maxAllowedPacket);
        if ($this->url === null) {
            return;
        }
        if ($this->connected && !$this->busy) {
            $this->pool->markConnFree($this, $this->url);
        }
    }
1145059
public function proccess()
    {
        foreach ($this->runningJobs as $jobData) {
            $this->isRunning($jobData->job);
        }

        foreach ($this->pendingJobs as $job) {
            $this->start($job);
        }
    }
565192
public function onDispatcherReady()
    {
        if ($this->dispatcher && $this->dispatcher->isReady()) {
            $context = $this->currentContext;
            $event = $this->currentEvent;
            $this->dispatcher = null;
            $this->currentContext = null;
            $this->currentEvent = null;
            $this->doCheckTransitions($context, $event);
            $this->mutex->releaseLock();
        }
    }
103155
public function onFinish()
    {
        parent::onFinish();
        $this->event('disconnect');
        if (isset($this->xml)) {
            $this->xml->finish();
        }
        unset($this->roster);
        if ($this->keepaliveTimer) {
            Timer::remove($this->keepaliveTimer);
        }
    }
884210
public function prePersist()
    {
        if (!$this->getCreatedAt()) {
            $this->setCreatedAt(new \DateTime());
        }

        if (!$this->getUpdatedAt()) {
            $this->setUpdatedAt(new \DateTime());
        }
    }
10915
private function componentsReady()
    {
        $this->getRegistryCache()->isAppReady();

        if ($this->componentsloaded) {
            foreach ($this->components as $component) {
                $component->ready($this);
            }
        }
    }
423415
private function waitForAllToFinish(): void
    {
        do {
            foreach ($this->workers as $key => $worker) {
                if (!$worker->isRunning()) {
                    unset($this->workers[$key]);
                }
            }
            usleep(10000);
            $this->printOutput();
        } while (\count($this->workers) > 0);
    }