mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
timeouts tests pass
This commit is contained in:
@@ -174,8 +174,8 @@ App::error()
|
||||
->inject('utopia')
|
||||
->action(function (throwable $error, Request $request, Database $dbForProject, App $utopia) {
|
||||
try {
|
||||
$route = $utopia->match($request);
|
||||
if ($error instanceof Timeout) {
|
||||
$route = $utopia->match($request);
|
||||
$collectionId = $route->getParamValue('collectionId');
|
||||
$databaseId = $route->getParamValue('databaseId');
|
||||
$queries = $request->getParam('queries');
|
||||
@@ -214,15 +214,13 @@ App::error()
|
||||
])));
|
||||
} else {
|
||||
$document['count']++;
|
||||
$max = intval(App::getEnv('_APP_SLOW_QUERIES_MAX_HITS', 99999)); // todo: set default value
|
||||
var_dump('_APP_SLOW_QUERIES_MAX_HITS');
|
||||
var_dump($max);
|
||||
|
||||
if ($document['count'] > $max) {
|
||||
$max = intval(App::getEnv('_APP_SLOW_QUERIES_MAX_HITS', 9999));
|
||||
if ($document['count'] >= $max) {
|
||||
$document['blocked'] = true;
|
||||
}
|
||||
$document = Authorization::skip(fn() => $dbForProject->updateDocument('slowQueries', $document->getId(), $document));
|
||||
}
|
||||
|
||||
if ($document['blocked'] === true) {
|
||||
throw new Exception(Exception::TIMEOUT_BLOCKED);
|
||||
}
|
||||
|
||||
@@ -997,8 +997,6 @@ trait DatabasesBase
|
||||
]);
|
||||
|
||||
$this->assertEquals(408, $documents['headers']['status-code']);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -1013,7 +1011,6 @@ trait DatabasesBase
|
||||
], $this->getHeaders()), [
|
||||
'queries' => ['sleep("$id", 1)'],
|
||||
]);
|
||||
|
||||
$this->assertEquals(403, $documents['headers']['status-code']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user