From dda7c4c87599778beddf29d2b7cbdb27f4a49503 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 6 Apr 2026 19:34:07 +0530 Subject: [PATCH] Fix coroutine DB timeout leakage --- app/init/resources/request.php | 2 +- src/Appwrite/Utopia/Database/Adapter/Pool.php | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/Appwrite/Utopia/Database/Adapter/Pool.php diff --git a/app/init/resources/request.php b/app/init/resources/request.php index eecfc0df68..83a6db68c4 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -26,6 +26,7 @@ use Appwrite\Network\Platform; use Appwrite\Network\Validator\Origin; use Appwrite\Network\Validator\Redirect; use Appwrite\Usage\Context as UsageContext; +use Appwrite\Utopia\Database\Adapter\Pool as DatabasePool; use Appwrite\Utopia\Database\Documents\User; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; @@ -42,7 +43,6 @@ use Utopia\Auth\Proofs\Token; use Utopia\Auth\Store; use Utopia\Cache\Cache; use Utopia\Config\Config; -use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime as DatabaseDateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Utopia/Database/Adapter/Pool.php b/src/Appwrite/Utopia/Database/Adapter/Pool.php new file mode 100644 index 0000000000..6c4e4314fe --- /dev/null +++ b/src/Appwrite/Utopia/Database/Adapter/Pool.php @@ -0,0 +1,22 @@ +timeout = $milliseconds; + + $this->delegate(__FUNCTION__, \func_get_args()); + } + + public function clearTimeout(string $event = Database::EVENT_ALL): void + { + $this->timeout = 0; + + $this->delegate(__FUNCTION__, \func_get_args()); + } +}