diff --git a/app/controllers/general.php b/app/controllers/general.php index d37b4b6ef4..4445353a04 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1026,10 +1026,6 @@ Http::wildcard() throw new AppwriteException(AppwriteException::GENERAL_ROUTE_NOT_FOUND); }); -foreach (Config::getParam('services', []) as $service) { - //include_once $service['controller']; -} - include_once 'mock.php'; include_once 'shared/api.php'; include_once 'shared/api/auth.php'; diff --git a/app/controllers/shared/api/auth.php b/app/controllers/shared/api/auth.php index a2bda7cff7..bea9c9752b 100644 --- a/app/controllers/shared/api/auth.php +++ b/app/controllers/shared/api/auth.php @@ -55,7 +55,7 @@ Http::init() return; } - if (str_contains($route->getPath(), '/v1/graphql')) { // Skip for graphQL recursive call + if ($route->getLabel('sdk.namespace','') === 'graphql') { // Skip for graphQL recursive call return; } diff --git a/app/realtime.php b/app/realtime.php index 17f5974791..4d2cceae9a 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -138,7 +138,7 @@ $server->onStart(function () use ($stats, $container, $containerId, &$statsDocum sleep(DATABASE_RECONNECT_SLEEP); } } while (true); - // TODO NOW $registry->get('pools')->reclaim(); + ($container->get('connections'))->reclaim(); }); /** @@ -166,7 +166,8 @@ $server->onStart(function () use ($stats, $container, $containerId, &$statsDocum } catch (Throwable $th) { call_user_func($logError, $th, "updateWorkerDocument"); } finally { - // TODO NOW $registry->get('pools')->reclaim(); + ($container->get('connections'))->reclaim(); + $container->refresh('dbForConsole'); } }); } @@ -231,7 +232,8 @@ $server->onWorkerStart(function (int $workerId) use ($server, $container, $stats 'data' => $event['data'] ])); } - // TODO NOW $registry->get('pools')->reclaim(); + ($container->get('connections'))->reclaim(); + $container->refresh('dbForConsole'); } } /** @@ -311,7 +313,6 @@ $server->onWorkerStart(function (int $workerId) use ($server, $container, $stats $realtime->unsubscribe($connection); $realtime->subscribe($projectId, $connection, $roles, $channels); - //TODO NOW $registry->get('pools')->reclaim(); } } @@ -343,8 +344,8 @@ $server->onWorkerStart(function (int $workerId) use ($server, $container, $stats sleep(DATABASE_RECONNECT_SLEEP); continue; } finally { - //$registry->get('pools')->reclaim(); - // TODO eldad add connections reclaim + ($container->get('connections'))->reclaim(); + $container->refresh('dbForConsole'); } } @@ -369,7 +370,6 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, Console::info("Connection open (user: {$connection})"); try { - $dbForConsole = $container->get('dbForConsole'); /** @var Document $project */ $project = $container->refresh('project')->get('project'); @@ -586,7 +586,8 @@ $server->onMessage(function (int $connection, string $message) use ($server, $co $server->close($connection, $th->getCode()); } } finally { - // TODO NOW $registry->get('pools')->reclaim(); + ($container->get('connections'))->reclaim(); + $container->refresh('dbForConsole'); } }); diff --git a/app/worker.php b/app/worker.php index 57343ce38d..80d027fbc2 100644 --- a/app/worker.php +++ b/app/worker.php @@ -104,7 +104,7 @@ $container->set($executionRetention); $container->set($deviceForLocalFiles); $platform = new Appwrite(); -$args = $_SERVER['argv']; +$args = $platform->getEnv('argv'); if (!isset($args[1])) { Console::error('Missing worker name'); diff --git a/src/Appwrite/Auth/Validator/MockNumber.php b/src/Appwrite/Auth/Validator/MockNumber.php index b92bb3b6bf..141a469724 100644 --- a/src/Appwrite/Auth/Validator/MockNumber.php +++ b/src/Appwrite/Auth/Validator/MockNumber.php @@ -46,7 +46,7 @@ class MockNumber extends Validator return false; } - $otp = new Text(6, 6, Validator\Text::NUMBERS); + $otp = new Text(6, 6, Text::NUMBERS); if (!$otp->isValid($value['otp'])) { $this->message = 'Invalid OTP. Please make sure the OTP is a 6 digit number'; return false;