1
0
Fork 0
mirror of synced 2024-09-29 08:51:28 +13:00

Allow multiprocess for db queue

This commit is contained in:
Jake Barnby 2023-10-11 21:28:29 +13:00
parent 662233b026
commit 7a78f49eb9
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
4 changed files with 12 additions and 4 deletions

1
.env
View file

@ -5,6 +5,7 @@ _APP_CONSOLE_WHITELIST_ROOT=disabled
_APP_CONSOLE_WHITELIST_EMAILS=
_APP_CONSOLE_WHITELIST_IPS=
_APP_CONNECTIONS_QUEUE_PER_WORKER=enabled
_APP_CONNECTIONS_DB_QUEUES=v1-database-0,v1-database-1,v1-database-2
_APP_SYSTEM_EMAIL_NAME=Appwrite
_APP_SYSTEM_EMAIL_ADDRESS=team@appwrite.io
_APP_SYSTEM_SECURITY_EMAIL_ADDRESS=security@appwrite.io

View file

@ -372,6 +372,7 @@ services:
- mariadb
environment:
- _APP_ENV
- _APP_CONNECTIONS_QUEUE_PER_WORKER
- _APP_CONNECTIONS_DB_QUEUES
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1

View file

@ -2,6 +2,7 @@
namespace Appwrite\Event;
use Utopia\App;
use Utopia\Database\Document;
use Utopia\Queue\Client;
use Utopia\Queue\Connection;
@ -16,10 +17,15 @@ class Database extends Event
public function __construct(protected Connection $connection)
{
parent::__construct($connection);
$dbQueues = App::getEnv('_APP_CONNECTIONS_DB_QUEUES');
$this
->setQueue(Event::DATABASE_QUEUE_NAME)
->setClass(Event::DATABASE_CLASS_NAME);
if (empty($dbQueues)) {
$queue = Event::DATABASE_QUEUE_NAME;
} else {
$queue = $this->getProject()->getAttribute('database');
}
parent::__construct($queue, Event::DATABASE_CLASS_NAME);
}
/**

View file

@ -481,7 +481,7 @@ class Databases extends Action
);
} finally {
$target = Realtime::fromPayload(
// Pass first, most verbose event pattern
// Pass first, most verbose event pattern
event: $events[0],
payload: $index,
project: $project