Allow multiprocess for db queue
This commit is contained in:
parent
662233b026
commit
7a78f49eb9
4 changed files with 12 additions and 4 deletions
1
.env
1
.env
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue