Xboard/webman.php

30 lines
613 B
PHP
Raw Normal View History

2023-11-17 01:44:01 -05:00
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Adapterman\Adapterman;
use Workerman\Worker;
2023-11-17 01:44:01 -05:00
Adapterman::init();
$http_worker = new Worker('http://127.0.0.1:7010');
$http_worker->count = getenv('WEBMAN_WORKERS') ?: max(swoole_cpu_num(), 2);
$http_worker->name = 'AdapterMan';
2023-11-17 01:44:01 -05:00
$http_worker->onWorkerStart = static function () {
//init();
require __DIR__ . '/start.php';
2023-11-17 01:44:01 -05:00
};
$http_worker->onMessage = static function ($connection, $request) {
static $request_count;
2023-11-17 01:44:01 -05:00
$connection->send(run());
if (++$request_count > 10000) {
Worker::stopAll();
}
2023-11-17 01:44:01 -05:00
};
Worker::runAll();