Use swoole_cpu_num instead of shelling out before the server starts
This commit is contained in:
@@ -154,7 +154,7 @@ $streamsPayload = static function(string $id,array $row): array {
|
||||
};
|
||||
|
||||
$server = new Server('0.0.0.0',$port,SWOOLE_PROCESS,SWOOLE_SOCK_TCP);
|
||||
$cpu=max(1,(int)(shell_exec('getconf _NPROCESSORS_ONLN 2>/dev/null') ?: 1));
|
||||
$cpu=max(1,(int)(function_exists('swoole_cpu_num') ? swoole_cpu_num() : 1));
|
||||
$server->set(['worker_num'=>$cpu,'max_request'=>10000,'dispatch_mode'=>2,'enable_coroutine'=>true,'http_compression'=>false,'package_max_length'=>8*1024*1024,'open_tcp_nodelay'=>true,'log_level'=>SWOOLE_LOG_WARNING]);
|
||||
$server->on('WorkerStart', function() use (&$store,&$media,$dbPath,$mediaDir,$mediaMarker,$mediaBudget,$ytDlpPath,$ffmpegPath,$ffprobePath) {
|
||||
$store = new Store($dbPath, false);
|
||||
|
||||
Reference in New Issue
Block a user