diff --git a/alt/swoole/server.php b/alt/swoole/server.php index c694d53..c6c5c59 100644 --- a/alt/swoole/server.php +++ b/alt/swoole/server.php @@ -11,7 +11,6 @@ require __DIR__ . '/asset-manifest.php'; require __DIR__ . '/database.php'; require __DIR__ . '/media-cache.php'; -Swoole\Runtime::enableCoroutine(true, SWOOLE_HOOK_ALL); date_default_timezone_set('UTC'); $root = getenv('PUBLIC_DIR') ?: '/app/public'; @@ -36,6 +35,8 @@ $media = null; // Create the schema before Swoole forks; PDO handles are never inherited by workers. $schemaStore = new Store($dbPath); $schemaStore->close(); +// Hooks go on only after the blocking start-up work above (proc_open needs a coroutine once hooked). +Swoole\Runtime::enableCoroutine(true, SWOOLE_HOOK_ALL); $mime = ['html'=>'text/html; charset=utf-8','js'=>'text/javascript; charset=utf-8','mjs'=>'text/javascript; charset=utf-8','css'=>'text/css; charset=utf-8','json'=>'application/json; charset=utf-8','webmanifest'=>'application/manifest+json','svg'=>'image/svg+xml','png'=>'image/png','jpg'=>'image/jpeg','jpeg'=>'image/jpeg','webp'=>'image/webp','woff2'=>'font/woff2','woff'=>'font/woff','ttf'=>'font/ttf','wasm'=>'application/wasm','ico'=>'image/x-icon','txt'=>'text/plain; charset=utf-8','mp4'=>'video/mp4','m4a'=>'audio/mp4']; $searchMem=[]; $searchInFlight=[]; $streamMem=[]; $streamInFlight=[]; $searchMax=200; $searchTtl=600; $searchStale=15*86400; $searchWrites=0;