Skip to content

Commit 79eaeb4

Browse files
abnegateclaude
andcommitted
fix: SharedTables multi-tenant cleanup and Pool timeout propagation
- Catch exception when deleting SharedTables collection under second tenant (physical table already dropped by first tenant's delete) - Forward clearTimeout() to child adapters in Pool delegate/transaction to prevent stale MAX_EXECUTION_TIME from persisting across pool reuse Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 94b44f9 commit 79eaeb4

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

phpstan-baseline.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,13 +1135,13 @@ parameters:
11351135
path: tests/e2e/Adapter/Base.php
11361136

11371137
-
1138-
message: '#^Method Utopia\\Database\\Hook\\Lifecycle@anonymous/tests/e2e/Adapter/Scopes/CollectionTests\.php\:1080\:\:__construct\(\) has parameter \$events with no value type specified in iterable type array\.$#'
1138+
message: '#^Method Utopia\\Database\\Hook\\Lifecycle@anonymous/tests/e2e/Adapter/Scopes/CollectionTests\.php\:1083\:\:__construct\(\) has parameter \$events with no value type specified in iterable type array\.$#'
11391139
identifier: missingType.iterableValue
11401140
count: 1
11411141
path: tests/e2e/Adapter/Base.php
11421142

11431143
-
1144-
message: '#^Method Utopia\\Database\\Hook\\Lifecycle@anonymous/tests/e2e/Adapter/Scopes/CollectionTests\.php\:1080\:\:__construct\(\) has parameter \$test with no type specified\.$#'
1144+
message: '#^Method Utopia\\Database\\Hook\\Lifecycle@anonymous/tests/e2e/Adapter/Scopes/CollectionTests\.php\:1083\:\:__construct\(\) has parameter \$test with no type specified\.$#'
11451145
identifier: missingType.parameter
11461146
count: 1
11471147
path: tests/e2e/Adapter/Base.php

src/Database/Adapter/Pool.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public function delegate(string $method, array $args): mixed
6969

7070
if ($this->getTimeout() > 0) {
7171
$adapter->setTimeout($this->getTimeout());
72+
} else {
73+
$adapter->clearTimeout();
7274
}
7375
$adapter->resetDebug();
7476
foreach ($this->getDebug() as $key => $value) {
@@ -224,6 +226,8 @@ public function withTransaction(callable $callback): mixed
224226

225227
if ($this->getTimeout() > 0) {
226228
$adapter->setTimeout($this->getTimeout());
229+
} else {
230+
$adapter->clearTimeout();
227231
}
228232
$adapter->resetDebug();
229233
foreach ($this->getDebug() as $key => $value) {

tests/e2e/Adapter/Scopes/CollectionTests.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,11 @@ public function testSharedTablesMultiTenantCreateCollection(): void
962962
} else {
963963
$database->setTenant($tenant1);
964964
$database->deleteCollection($colName);
965-
$database->setTenant($tenant2);
966-
$database->deleteCollection($colName);
965+
try {
966+
$database->setTenant($tenant2);
967+
$database->deleteCollection($colName);
968+
} catch (\Throwable) {
969+
}
967970
}
968971
} finally {
969972
$database

0 commit comments

Comments
 (0)