This commit is contained in:
shimon 2024-10-08 21:51:43 +03:00
parent d2c66894fd
commit 7d7b2c7544
3 changed files with 1 additions and 35 deletions

View file

@ -88,11 +88,7 @@ App::post('/v1/projects')
->inject('hooks') ->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) { ->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); $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()) { if ($team->isEmpty()) {
throw new Exception(Exception::TEAM_NOT_FOUND); throw new Exception(Exception::TEAM_NOT_FOUND);
@ -158,9 +154,6 @@ App::post('/v1/projects')
} }
try { try {
$ctime = \microtime(true);
var_dump($request->getURI() . " [".$region."|".System::getEnv('_APP_REGION')."] - Before createDocument('projects')");
$project = $dbForConsole->createDocument('projects', new Document([ $project = $dbForConsole->createDocument('projects', new Document([
'$id' => $projectId, '$id' => $projectId,
'$permissions' => [ '$permissions' => [
@ -195,8 +188,6 @@ App::post('/v1/projects')
'database' => $dsn, 'database' => $dsn,
])); ]));
$diff = \microtime(true) - $ctime;
var_dump($request->getURI() . " [".$region."|".System::getEnv('_APP_REGION')."] - After createDocument('projects') : " . $diff . " sec");
} catch (Duplicate) { } catch (Duplicate) {
throw new Exception(Exception::PROJECT_ALREADY_EXISTS); throw new Exception(Exception::PROJECT_ALREADY_EXISTS);
} }
@ -248,11 +239,7 @@ App::post('/v1/projects')
}, $collection['indexes']); }, $collection['indexes']);
try { try {
$ctime = \microtime(true);
var_dump($request->getURI() ." [".$region."|".System::getEnv('_APP_REGION')."] - Before createCollection('".$key."')");
$dbForProject->createCollection($key, $attributes, $indexes); $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) { } catch (Duplicate) {
// Collection already exists // Collection already exists
} }

View file

@ -461,10 +461,7 @@ App::init()
* Appwrite Router * Appwrite Router
*/ */
$host = $request->getHostname() ?? '';
$ctime = \microtime(true);
var_dump($request->getURI() . " [".$project->getAttribute('region')."|".System::getEnv('_APP_REGION')."] - Before general first init hook");
$host = $request->getHostname() ?? '';
$mainDomain = System::getEnv('_APP_DOMAIN', ''); $mainDomain = System::getEnv('_APP_DOMAIN', '');
// Only run Router when external domain // Only run Router when external domain
if ($host !== $mainDomain) { if ($host !== $mainDomain) {
@ -666,8 +663,6 @@ App::init()
throw new AppwriteException(AppwriteException::GENERAL_UNKNOWN_ORIGIN, $originValidator->getDescription()); 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() App::options()

View file

@ -162,8 +162,6 @@ App::init()
->inject('mode') ->inject('mode')
->inject('team') ->inject('team')
->action(function (App $utopia, Request $request, Database $dbForConsole, Document $project, Document $user, ?Document $session, array $servers, string $mode, Document $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(); $route = $utopia->getRoute();
@ -347,8 +345,6 @@ App::init()
throw new Exception(Exception::USER_MORE_FACTORS_REQUIRED); 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() App::init()
@ -368,8 +364,6 @@ App::init()
->inject('dbForProject') ->inject('dbForProject')
->inject('mode') ->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) { ->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(); $route = $utopia->getRoute();
if ( 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() App::init()
@ -559,8 +551,6 @@ App::shutdown()
->inject('project') ->inject('project')
->inject('dbForProject') ->inject('dbForProject')
->action(function (App $utopia, Request $request, Response $response, Document $project, Database $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(); $route = $utopia->getRoute();
$sessionLimit = $project->getAttribute('auths', [])['maxSessions'] ?? APP_LIMIT_USER_SESSIONS_DEFAULT; $sessionLimit = $project->getAttribute('auths', [])['maxSessions'] ?? APP_LIMIT_USER_SESSIONS_DEFAULT;
$session = $response->getPayload(); $session = $response->getPayload();
@ -586,8 +576,6 @@ App::shutdown()
} }
$dbForProject->purgeCachedDocument('users', $userId); $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() App::shutdown()
@ -610,8 +598,6 @@ App::shutdown()
->inject('dbForConsole') ->inject('dbForConsole')
->inject('realtimeConnection') ->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) { ->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(); $route = $utopia->getRoute();
$responsePayload = $response->getPayload(); $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() App::init()