diff --git a/app/http.php b/app/http.php index b1a27117ff..086260cb62 100644 --- a/app/http.php +++ b/app/http.php @@ -3,6 +3,7 @@ require_once __DIR__ . '/../vendor/autoload.php'; use Appwrite\Utopia\Response; +use Swoole\Constant; use Swoole\Process; use Swoole\Http\Server; use Swoole\Http\Request as SwooleRequest; @@ -20,12 +21,15 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Swoole\Files; use Appwrite\Utopia\Request; -use Swoole\Coroutine; use Utopia\Logger\Log; use Utopia\Logger\Log\User; use Utopia\Pools\Group; -$http = new Server("0.0.0.0", App::getEnv('PORT', 80)); +$http = new Server( + host: "0.0.0.0", + port: App::getEnv('PORT', 80), + mode: SWOOLE_PROCESS, +); $payloadSize = 6 * (1024 * 1024); // 6MB $workerNumber = swoole_cpu_num() * intval(App::getEnv('_APP_WORKER_PER_CORE', 6)); @@ -34,23 +38,21 @@ $http ->set([ 'worker_num' => $workerNumber, 'open_http2_protocol' => true, - // 'document_root' => __DIR__.'/../public', - // 'enable_static_handler' => true, 'http_compression' => true, 'http_compression_level' => 6, 'package_max_length' => $payloadSize, 'buffer_output_size' => $payloadSize, ]); -$http->on('WorkerStart', function ($server, $workerId) { +$http->on(Constant::EVENT_WORKER_START, function ($server, $workerId) { Console::success('Worker ' . ++$workerId . ' started successfully'); }); -$http->on('BeforeReload', function ($server, $workerId) { +$http->on(Constant::EVENT_BEFORE_RELOAD, function ($server, $workerId) { Console::success('Starting reload...'); }); -$http->on('AfterReload', function ($server, $workerId) { +$http->on(Constant::EVENT_AFTER_RELOAD, function ($server, $workerId) { Console::success('Reload completed...'); }); @@ -58,7 +60,7 @@ Files::load(__DIR__ . '/../console'); include __DIR__ . '/controllers/general.php'; -$http->on('start', function (Server $http) use ($payloadSize, $register) { +$http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $register) { $app = new App('UTC'); go(function () use ($register, $app) { diff --git a/composer.json b/composer.json index 3131c14b8d..b1a0c25445 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ "utopia-php/cache": "0.9.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.48.*", + "utopia-php/database": "0.48.2", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", diff --git a/composer.lock b/composer.lock index c008f3d599..ab4b3c8829 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a65e4309e3fd851aec97be2cf5b83cb4", + "content-hash": "510f3498b35c5ec3289b7bed6a2ef9c9", "packages": [ { "name": "adhocore/jwt", @@ -1552,16 +1552,16 @@ }, { "name": "utopia-php/database", - "version": "0.48.3", + "version": "0.48.2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "c7dd97d92f52a0aec9951e0b02309a100f3f24a9" + "reference": "0a231a2874fdbc0cf2ae2170b3f132fdee0ddfd4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/c7dd97d92f52a0aec9951e0b02309a100f3f24a9", - "reference": "c7dd97d92f52a0aec9951e0b02309a100f3f24a9", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0a231a2874fdbc0cf2ae2170b3f132fdee0ddfd4", + "reference": "0a231a2874fdbc0cf2ae2170b3f132fdee0ddfd4", "shasum": "" }, "require": { @@ -1569,7 +1569,7 @@ "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.9.*", - "utopia-php/framework": "0.33.*", + "utopia-php/framework": "0.*.*", "utopia-php/mongo": "0.3.*" }, "require-dev": { @@ -1602,9 +1602,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.48.3" + "source": "https://github.com/utopia-php/database/tree/0.48.2" }, - "time": "2024-02-21T08:32:09+00:00" + "time": "2024-02-02T14:10:14+00:00" }, { "name": "utopia-php/domains",