.env _APP_SLOW_QUERIES_MAX_HITS set to 5

This commit is contained in:
fogelito
2023-03-06 11:40:35 +02:00
parent bd582bd00d
commit 408e611b76
5 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ _APP_LOGGING_CONFIG=
_APP_GRAPHQL_MAX_BATCH_SIZE=10
_APP_GRAPHQL_MAX_COMPLEXITY=250
_APP_GRAPHQL_MAX_DEPTH=3
_APP_SLOW_QUERIES_MAX_HITS=2
_APP_SLOW_QUERIES_MAX_HITS=5
_APP_SLOW_QUERIES_TIMEOUT=1000
_APP_SLOW_QUERIES_BLOCK=enabled
DOCKERHUB_PULL_USERNAME=
+1 -1
View File
@@ -204,7 +204,7 @@ App::error()
])));
} else {
$document->setAttribute('count', $document->getAttribute('count') + 1);
$max = intval(App::getEnv('_APP_SLOW_QUERIES_MAX_HITS', 9999));
$max = intval(App::getEnv('_APP_SLOW_QUERIES_MAX_HITS', 5));
if ($document->getAttribute('count') >= $max) {
$document->setAttribute('blocked', true);
}
Generated
+7 -7
View File
@@ -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": "6122f6434efda86eca49811494128275",
"content-hash": "a6df2be9a59305de9a2f49acde473c60",
"packages": [
{
"name": "adhocore/jwt",
@@ -2222,16 +2222,16 @@
},
{
"name": "utopia-php/framework",
"version": "0.28.1",
"version": "0.27.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/framework.git",
"reference": "7f22c556fc5991e54e5811a68fb39809b21bda55"
"reference": "b8d0447f5c98291d7759db05460ecced29a0f9ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/7f22c556fc5991e54e5811a68fb39809b21bda55",
"reference": "7f22c556fc5991e54e5811a68fb39809b21bda55",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/b8d0447f5c98291d7759db05460ecced29a0f9ee",
"reference": "b8d0447f5c98291d7759db05460ecced29a0f9ee",
"shasum": ""
},
"require": {
@@ -2260,9 +2260,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/framework/issues",
"source": "https://github.com/utopia-php/framework/tree/0.28.1"
"source": "https://github.com/utopia-php/framework/tree/0.27.0"
},
"time": "2023-03-02T08:16:01+00:00"
"time": "2023-01-29T05:36:17+00:00"
},
{
"name": "utopia-php/image",
@@ -1049,7 +1049,7 @@ trait DatabasesBase
}
$docs = [];
for ($i = 0; $i <= 2; $i++) {
for ($i = 0; $i <= 5; $i++) {
$docs[] = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['$id'] . '/documents', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -1060,6 +1060,9 @@ trait DatabasesBase
}
$this->assertEquals(408, $docs[0]['headers']['status-code']); // insert
$this->assertEquals(408, $docs[0]['headers']['status-code']); // update
$this->assertEquals(408, $docs[0]['headers']['status-code']); // update
$this->assertEquals(408, $docs[0]['headers']['status-code']); // update
$this->assertEquals(403, $docs[1]['headers']['status-code']); // update
$this->assertEquals(403, $docs[2]['headers']['status-code']); // blocked
}
@@ -266,7 +266,7 @@ class DatabasesConsoleClientTest extends Scope
}
$docs = [];
for ($i = 0; $i <= 2; $i++) {
for ($i = 0; $i <= 5; $i++) {
$docs[] = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['$id'] . '/documents', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -277,6 +277,9 @@ class DatabasesConsoleClientTest extends Scope
}
$this->assertEquals(408, $docs[0]['headers']['status-code']); // insert
$this->assertEquals(408, $docs[0]['headers']['status-code']); // update
$this->assertEquals(408, $docs[0]['headers']['status-code']); // update
$this->assertEquals(408, $docs[0]['headers']['status-code']); // update
$this->assertEquals(403, $docs[1]['headers']['status-code']); // update
$this->assertEquals(403, $docs[2]['headers']['status-code']); // blocked
}