From 80636e8a91a02ef1c07ca1fb02ae92c199a01139 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 30 Sep 2025 00:03:12 +0530 Subject: [PATCH] updated timeouts --- composer.lock | 71 +++++++++---------- .../Databases/Collections/Indexes/Create.php | 4 +- .../Modules/Databases/Http/Init/Timeout.php | 4 +- .../Databases/DocumentsDB/DatabasesBase.php | 7 +- .../DocumentsDB/DatabasesCustomServerTest.php | 10 ++- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/composer.lock b/composer.lock index 468f47acf0..377dde0bfd 100644 --- a/composer.lock +++ b/composer.lock @@ -2673,16 +2673,16 @@ }, { "name": "symfony/http-client", - "version": "v7.3.3", + "version": "v7.3.4", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "333b9bd7639cbdaecd25a3a48a9d2dcfaa86e019" + "reference": "4b62871a01c49457cf2a8e560af7ee8a94b87a62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/333b9bd7639cbdaecd25a3a48a9d2dcfaa86e019", - "reference": "333b9bd7639cbdaecd25a3a48a9d2dcfaa86e019", + "url": "https://api.github.com/repos/symfony/http-client/zipball/4b62871a01c49457cf2a8e560af7ee8a94b87a62", + "reference": "4b62871a01c49457cf2a8e560af7ee8a94b87a62", "shasum": "" }, "require": { @@ -2749,7 +2749,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.3.3" + "source": "https://github.com/symfony/http-client/tree/v7.3.4" }, "funding": [ { @@ -2769,7 +2769,7 @@ "type": "tidelift" } ], - "time": "2025-08-27T07:45:05+00:00" + "time": "2025-09-11T10:12:26+00:00" }, { "name": "symfony/http-client-contracts", @@ -3796,12 +3796,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "6a36761adf6973727b58a465171da95f9b2fe171" + "reference": "f52c1e9fda1f55e784adeb28f0be8ff4feb9686c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/6a36761adf6973727b58a465171da95f9b2fe171", - "reference": "6a36761adf6973727b58a465171da95f9b2fe171", + "url": "https://api.github.com/repos/utopia-php/database/zipball/f52c1e9fda1f55e784adeb28f0be8ff4feb9686c", + "reference": "f52c1e9fda1f55e784adeb28f0be8ff4feb9686c", "shasum": "" }, "require": { @@ -3810,7 +3810,7 @@ "php": ">=8.1", "utopia-php/cache": "0.13.*", "utopia-php/framework": "0.33.*", - "utopia-php/mongo": "0.6.0", + "utopia-php/mongo": "0.7.*", "utopia-php/pools": "0.8.*" }, "require-dev": { @@ -3845,7 +3845,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/attributes-fix-schemaless" }, - "time": "2025-09-26T08:10:25+00:00" + "time": "2025-09-29T11:14:13+00:00" }, { "name": "utopia-php/detector", @@ -4401,16 +4401,16 @@ }, { "name": "utopia-php/mongo", - "version": "0.6.0", + "version": "0.7.0", "source": { "type": "git", "url": "https://github.com/utopia-php/mongo.git", - "reference": "589e329a7fe4200e23ca87d65f3eb25a70ef0505" + "reference": "1363598f9f8e6c066f5821704be95e3e24ea66aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/mongo/zipball/589e329a7fe4200e23ca87d65f3eb25a70ef0505", - "reference": "589e329a7fe4200e23ca87d65f3eb25a70ef0505", + "url": "https://api.github.com/repos/utopia-php/mongo/zipball/1363598f9f8e6c066f5821704be95e3e24ea66aa", + "reference": "1363598f9f8e6c066f5821704be95e3e24ea66aa", "shasum": "" }, "require": { @@ -4456,9 +4456,9 @@ ], "support": { "issues": "https://github.com/utopia-php/mongo/issues", - "source": "https://github.com/utopia-php/mongo/tree/0.6.0" + "source": "https://github.com/utopia-php/mongo/tree/0.7.0" }, - "time": "2025-09-11T13:26:21+00:00" + "time": "2025-09-26T09:15:55+00:00" }, { "name": "utopia-php/orchestration", @@ -7716,16 +7716,16 @@ }, { "name": "symfony/console", - "version": "v7.3.3", + "version": "v7.3.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "cb0102a1c5ac3807cf3fdf8bea96007df7fdbea7" + "reference": "2b9c5fafbac0399a20a2e82429e2bd735dcfb7db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/cb0102a1c5ac3807cf3fdf8bea96007df7fdbea7", - "reference": "cb0102a1c5ac3807cf3fdf8bea96007df7fdbea7", + "url": "https://api.github.com/repos/symfony/console/zipball/2b9c5fafbac0399a20a2e82429e2bd735dcfb7db", + "reference": "2b9c5fafbac0399a20a2e82429e2bd735dcfb7db", "shasum": "" }, "require": { @@ -7790,7 +7790,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.3.3" + "source": "https://github.com/symfony/console/tree/v7.3.4" }, "funding": [ { @@ -7810,7 +7810,7 @@ "type": "tidelift" } ], - "time": "2025-08-25T06:35:40+00:00" + "time": "2025-09-22T15:31:00+00:00" }, { "name": "symfony/filesystem", @@ -8353,16 +8353,16 @@ }, { "name": "symfony/process", - "version": "v7.3.3", + "version": "v7.3.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "32241012d521e2e8a9d713adb0812bb773b907f1" + "reference": "f24f8f316367b30810810d4eb30c543d7003ff3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/32241012d521e2e8a9d713adb0812bb773b907f1", - "reference": "32241012d521e2e8a9d713adb0812bb773b907f1", + "url": "https://api.github.com/repos/symfony/process/zipball/f24f8f316367b30810810d4eb30c543d7003ff3b", + "reference": "f24f8f316367b30810810d4eb30c543d7003ff3b", "shasum": "" }, "require": { @@ -8394,7 +8394,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.3.3" + "source": "https://github.com/symfony/process/tree/v7.3.4" }, "funding": [ { @@ -8414,20 +8414,20 @@ "type": "tidelift" } ], - "time": "2025-08-18T09:42:54+00:00" + "time": "2025-09-11T10:12:26+00:00" }, { "name": "symfony/string", - "version": "v7.3.3", + "version": "v7.3.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "17a426cce5fd1f0901fefa9b2a490d0038fd3c9c" + "reference": "f96476035142921000338bad71e5247fbc138872" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/17a426cce5fd1f0901fefa9b2a490d0038fd3c9c", - "reference": "17a426cce5fd1f0901fefa9b2a490d0038fd3c9c", + "url": "https://api.github.com/repos/symfony/string/zipball/f96476035142921000338bad71e5247fbc138872", + "reference": "f96476035142921000338bad71e5247fbc138872", "shasum": "" }, "require": { @@ -8442,7 +8442,6 @@ }, "require-dev": { "symfony/emoji": "^7.1", - "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", "symfony/translation-contracts": "^2.5|^3.0", @@ -8485,7 +8484,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.3.3" + "source": "https://github.com/symfony/string/tree/v7.3.4" }, "funding": [ { @@ -8505,7 +8504,7 @@ "type": "tidelift" } ], - "time": "2025-08-25T06:35:40+00:00" + "time": "2025-09-11T14:36:48+00:00" }, { "name": "textalk/websocket", diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index ab7f03f930..74e7c2e60b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -201,13 +201,15 @@ class Create extends Action $validator = new IndexValidator( $collection->getAttribute('attributes'), + $collection->getAttribute('indexes', []), $maxIndexLength, $internalIndexesKeys, $supportForIndexArray, $supportForSpatialAttributes, $supportForSpatialIndexNull, $supportForSpatialIndexOrder, - $dbForDatabaseRecords->getAdapter()->getSupportForAttributes() + $dbForDatabaseRecords->getAdapter()->getSupportForAttributes(), + $dbForDatabaseRecords->getAdapter()->getSupportForMultipleFulltextIndexes() ); if (!$validator->isValid($index)) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php index 19e202981b..31efc253bd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php @@ -24,11 +24,13 @@ class Timeout extends Action ->groups(['api', 'database']) ->inject('request') ->inject('dbForProject') - ->callback(function (Request $request, Database $dbForProject) { + ->inject('dbForDocuments') + ->callback(function (Request $request, Database $dbForProject, Database $dbForDocuments) { $timeout = \intval($request->getHeader('x-appwrite-timeout')); if (!empty($timeout) && App::isDevelopment()) { $dbForProject->setTimeout($timeout); + $dbForDocuments->setTimeout($timeout); } }); } diff --git a/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php b/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php index 93b69d8f22..a3902310c2 100644 --- a/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php @@ -275,8 +275,7 @@ trait DatabasesBase 'attributes' => ['releaseYear'], ]); - $this->assertEquals(409, $fulltextReleaseYear['headers']['status-code']); - $this->assertEquals($fulltextReleaseYear['body']['message'], 'Index with the requested key already exists. Try again with a different key.'); + $this->assertEquals(400, $fulltextReleaseYear['headers']['status-code']); $noAttributes = $this->client->call(Client::METHOD_POST, '/documentsdb/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', @@ -326,7 +325,7 @@ trait DatabasesBase 'attributes' => ['actors'], ]); - $this->assertEquals(202, $fulltextArray['headers']['status-code']); + $this->assertEquals(400, $fulltextArray['headers']['status-code']); $actorsArray = $this->client->call(Client::METHOD_POST, '/documentsdb/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', @@ -402,7 +401,7 @@ trait DatabasesBase ]), []); $this->assertIsArray($movies['body']['indexes']); - $this->assertCount(11, $movies['body']['indexes']); + $this->assertCount(10, $movies['body']['indexes']); $this->assertEquals($titleIndex['body']['key'], $movies['body']['indexes'][0]['key']); $this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']); $this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']); diff --git a/tests/e2e/Services/Databases/DocumentsDB/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DocumentsDB/DatabasesCustomServerTest.php index 0d6a631075..2dfa4e8eb9 100644 --- a/tests/e2e/Services/Databases/DocumentsDB/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DocumentsDB/DatabasesCustomServerTest.php @@ -2,14 +2,12 @@ namespace Tests\E2E\Services\Databases\DocumentsDB; -use Appwrite\Extend\Exception as AppwriteException; use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\Exception; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; @@ -711,7 +709,8 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals(200, $collection['headers']['status-code']); $this->assertIsArray($collection['body']['indexes']); $this->assertCount(2, $collection['body']['indexes']); - $this->assertEquals($index2['body']['key'], $collection['body']['indexes'][0]['key']); + $this->assertEquals($index1['body']['key'], $collection['body']['indexes'][0]['key']); + $this->assertEquals($index2['body']['key'], $collection['body']['indexes'][1]['key']); $this->assertIsArray($collection['body']['indexes'][0]['attributes']); $this->assertCount(2, $collection['body']['indexes'][0]['attributes']); $this->assertEquals('attribute1', $collection['body']['indexes'][0]['attributes'][0]); @@ -1756,7 +1755,7 @@ class DatabasesCustomServerTest extends Scope ]); $this->assertEquals(201, $doc['headers']['status-code']); - $this->assertNotEmpty($doc['body']['datetime']); + $this->assertEmpty($doc['body']['datetime']); $this->assertNotEmpty($doc['body']['$createdAt']); $this->assertNotEmpty($doc['body']['$updatedAt']); @@ -1766,7 +1765,7 @@ class DatabasesCustomServerTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $doc['headers']['status-code']); - $this->assertNotEmpty($doc['body']['datetime']); + $this->assertEmpty($doc['body']['datetime']); $this->assertNotEmpty($doc['body']['$createdAt']); $this->assertNotEmpty($doc['body']['$updatedAt']); @@ -2361,7 +2360,6 @@ class DatabasesCustomServerTest extends Scope ]); $this->assertEquals(201, $upsertDoc1['headers']['status-code']); - var_dump($upsertDoc1['body']['$createdAt']); $this->assertEquals($createDate, $upsertDoc1['body']['$createdAt']); $this->assertNotEquals($createDate, $upsertDoc1['body']['$updatedAt']);