From 1f97aaf591eb975b2b01b8af046834e58ac1b9b6 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 20 Oct 2023 14:40:59 +0200 Subject: [PATCH 1/3] fix: disable swoole tcp hook for mails worker --- src/Appwrite/Platform/Workers/Mails.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index b0cf28caeb..f247f0b764 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Workers; use Appwrite\Template\Template; use Exception; use PHPMailer\PHPMailer\PHPMailer; +use Swoole\Runtime; use Utopia\App; use Utopia\CLI\Console; use Utopia\Platform\Action; @@ -23,11 +24,12 @@ class Mails extends Action */ public function __construct() { + Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); $this ->desc('Mails worker') ->inject('message') ->inject('register') - ->callback(fn($message, $register) => $this->action($message, $register)); + ->callback(fn ($message, $register) => $this->action($message, $register)); } /** From 4f77510b0a711f70fd6458315ae4abed86bd1c32 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 20 Oct 2023 14:42:22 +0200 Subject: [PATCH 2/3] fix: only apply hook flags to mails worker --- src/Appwrite/Platform/Workers/Mails.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index f247f0b764..321d3aaa98 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -24,7 +24,6 @@ class Mails extends Action */ public function __construct() { - Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); $this ->desc('Mails worker') ->inject('message') @@ -41,7 +40,7 @@ class Mails extends Action */ public function action(Message $message, Registry $register): void { - + Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); $payload = $message->getPayload() ?? []; if (empty($payload)) { From d19baafc597ae3e8ede90ee9f7f1b3a7ada40aea Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 20 Oct 2023 14:43:48 +0200 Subject: [PATCH 3/3] chore: fix linting --- src/Appwrite/Platform/Workers/Mails.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 321d3aaa98..7a20212c9c 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -28,7 +28,7 @@ class Mails extends Action ->desc('Mails worker') ->inject('message') ->inject('register') - ->callback(fn ($message, $register) => $this->action($message, $register)); + ->callback(fn($message, $register) => $this->action($message, $register)); } /**