Laravoole\Commands\LaravooleCommand::fire PHP Method

fire() public method

Execute the console command.
public fire ( ) : mixed
return mixed
    public function fire()
    {
        switch ($action = $this->argument('action')) {
            case 'start':
                $this->start();
                break;
            case 'restart':
                $pid = $this->sendSignal(SIGTERM);
                $time = 0;
                while (posix_getpgid($pid) && $time <= 10) {
                    usleep(100000);
                    $time++;
                }
                if ($time > 100) {
                    echo 'timeout' . PHP_EOL;
                    exit(1);
                }
                $this->start();
                break;
            case 'stop':
            case 'quit':
            case 'reload':
            case 'reload_task':
                $map = ['stop' => SIGTERM, 'quit' => SIGQUIT, 'reload' => SIGUSR1, 'reload_task' => SIGUSR2];
                $this->sendSignal($map[$action]);
                break;
        }
    }