fix(messaging): fix worker crash when using custom SMTP provider

Due to a bug in the Swoole TCP hook, the worker crashes when doing the
TLS handshake. This PR disables the Swoole TCP hook just like we do
in the mails worker.

References:
* https://github.com/appwrite/appwrite/issues/7914
* https://github.com/appwrite/appwrite/pull/6966
* https://github.com/swoole/swoole-src/issues/4909
This commit is contained in:
Steven Nguyen 2024-04-03 13:43:38 -07:00
parent 955eb297ab
commit 3525cc6d1e
No known key found for this signature in database

View file

@ -4,6 +4,7 @@ namespace Appwrite\Platform\Workers;
use Appwrite\Event\Usage;
use Appwrite\Messaging\Status as MessageStatus;
use Swoole\Runtime;
use Utopia\App;
use Utopia\CLI\Console;
use Utopia\Config\Config;
@ -80,6 +81,7 @@ class Messaging extends Action
Device $deviceForLocalFiles,
Usage $queueForUsage
): void {
Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP);
$payload = $message->getPayload() ?? [];
if (empty($payload)) {