From 7d7b2c7544f376aa20ce7e4ffceaf7e7c7340bde Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 8 Oct 2024 21:51:43 +0300 Subject: [PATCH] debug --- app/controllers/api/projects.php | 13 ------------- app/controllers/general.php | 7 +------ app/controllers/shared/api.php | 16 ---------------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 31b713da9a..b950ca81fe 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -88,11 +88,7 @@ App::post('/v1/projects') ->inject('hooks') ->action(function (string $projectId, string $name, string $teamId, string $region, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Request $request, Response $response, Database $dbForConsole, Cache $cache, Group $pools, Hooks $hooks) { - $ctime = \microtime(true); - var_dump($request->getURI() . " [".$region."|".System::getEnv('_APP_REGION')."] - Before getDocument('teams')"); $team = $dbForConsole->getDocument('teams', $teamId); - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$region."|".System::getEnv('_APP_REGION')."] - After getDocument('teams') : " . $diff . " sec"); if ($team->isEmpty()) { throw new Exception(Exception::TEAM_NOT_FOUND); @@ -158,9 +154,6 @@ App::post('/v1/projects') } try { - - $ctime = \microtime(true); - var_dump($request->getURI() . " [".$region."|".System::getEnv('_APP_REGION')."] - Before createDocument('projects')"); $project = $dbForConsole->createDocument('projects', new Document([ '$id' => $projectId, '$permissions' => [ @@ -195,8 +188,6 @@ App::post('/v1/projects') 'database' => $dsn, ])); - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$region."|".System::getEnv('_APP_REGION')."] - After createDocument('projects') : " . $diff . " sec"); } catch (Duplicate) { throw new Exception(Exception::PROJECT_ALREADY_EXISTS); } @@ -248,11 +239,7 @@ App::post('/v1/projects') }, $collection['indexes']); try { - $ctime = \microtime(true); - var_dump($request->getURI() ." [".$region."|".System::getEnv('_APP_REGION')."] - Before createCollection('".$key."')"); $dbForProject->createCollection($key, $attributes, $indexes); - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$region."|".System::getEnv('_APP_REGION')."] - After createCollection('".$key."') : " . $diff . " sec"); } catch (Duplicate) { // Collection already exists } diff --git a/app/controllers/general.php b/app/controllers/general.php index 1ed164c1e8..971881c60d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -461,10 +461,7 @@ App::init() * Appwrite Router */ - - $ctime = \microtime(true); - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - Before general first init hook"); - $host = $request->getHostname() ?? ''; + $host = $request->getHostname() ?? ''; $mainDomain = System::getEnv('_APP_DOMAIN', ''); // Only run Router when external domain if ($host !== $mainDomain) { @@ -666,8 +663,6 @@ App::init() throw new AppwriteException(AppwriteException::GENERAL_UNKNOWN_ORIGIN, $originValidator->getDescription()); } - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - After general first init hook : " . $diff . " sec"); }); App::options() diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 0290f7786f..c5e4f516d6 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -162,8 +162,6 @@ App::init() ->inject('mode') ->inject('team') ->action(function (App $utopia, Request $request, Database $dbForConsole, Document $project, Document $user, ?Document $session, array $servers, string $mode, Document $team) { - $ctime = \microtime(true); - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - Before shared api first init hook"); $route = $utopia->getRoute(); @@ -347,8 +345,6 @@ App::init() throw new Exception(Exception::USER_MORE_FACTORS_REQUIRED); } } - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - After shared api first init hook : " . $diff . " sec"); }); App::init() @@ -368,8 +364,6 @@ App::init() ->inject('dbForProject') ->inject('mode') ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, Usage $queueForUsage, Database $dbForProject, string $mode) use ($databaseListener) { - $ctime = \microtime(true); - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - Before shared api second init hook"); $route = $utopia->getRoute(); if ( @@ -527,8 +521,6 @@ App::init() ; } } - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - After shared api second init hook : " . $diff . " sec"); }); App::init() @@ -559,8 +551,6 @@ App::shutdown() ->inject('project') ->inject('dbForProject') ->action(function (App $utopia, Request $request, Response $response, Document $project, Database $dbForProject) { - $ctime = \microtime(true); - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - Before shared api first shutdown hook"); $route = $utopia->getRoute(); $sessionLimit = $project->getAttribute('auths', [])['maxSessions'] ?? APP_LIMIT_USER_SESSIONS_DEFAULT; $session = $response->getPayload(); @@ -586,8 +576,6 @@ App::shutdown() } $dbForProject->purgeCachedDocument('users', $userId); - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - After shared api first shutdown hook : " . $diff . " sec"); }); App::shutdown() @@ -610,8 +598,6 @@ App::shutdown() ->inject('dbForConsole') ->inject('realtimeConnection') ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Event $queueForEvents, Audit $queueForAudits, Usage $queueForUsage, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, Messaging $queueForMessaging, Database $dbForProject, Func $queueForFunctions, string $mode, Database $dbForConsole, callable $realtimeConnection) use ($parseLabel) { - $ctime = \microtime(true); - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - Before shared api second shutdown hook"); $route = $utopia->getRoute(); $responsePayload = $response->getPayload(); @@ -815,8 +801,6 @@ App::shutdown() } } } - $diff = \microtime(true) - $ctime; - var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - After shared api second shutdown hook : " . $diff . " sec"); }); App::init()