mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
Set the queue name based on project DB
This commit is contained in:
parent
ca5b7f5b16
commit
365630ff39
2 changed files with 5 additions and 15 deletions
2
.env
2
.env
|
|
@ -4,7 +4,7 @@ _APP_WORKER_PER_CORE=6
|
|||
_APP_CONSOLE_WHITELIST_ROOT=disabled
|
||||
_APP_CONSOLE_WHITELIST_EMAILS=
|
||||
_APP_CONSOLE_WHITELIST_IPS=
|
||||
_APP_CONNECTIONS_DB_QUEUES=v1-database-0,v1-database-1
|
||||
_APP_CONNECTIONS_QUEUE_PER_WORKER=enabled
|
||||
_APP_SYSTEM_EMAIL_NAME=Appwrite
|
||||
_APP_SYSTEM_EMAIL_ADDRESS=team@appwrite.io
|
||||
_APP_SYSTEM_SECURITY_EMAIL_ADDRESS=security@appwrite.io
|
||||
|
|
|
|||
|
|
@ -28,23 +28,13 @@ class DatabaseV1 extends Worker
|
|||
{
|
||||
global $table, $lock;
|
||||
|
||||
$dbQueues = App::getEnv('_APP_CONNECTIONS_DB_QUEUES');
|
||||
$dbQueues = App::getEnv('_APP_CONNECTIONS_QUEUE_PER_WORKER', 'disabled');
|
||||
|
||||
if (empty($dbQueues)) {
|
||||
if ($dbQueues !== 'enabled') {
|
||||
$queue = 'v1-database';
|
||||
} elseif (\str_contains($dbQueues, ',')) {
|
||||
$dbQueues = \explode(',', $dbQueues);
|
||||
$dbQueues = \array_map('trim', $dbQueues);
|
||||
$dbQueues = \array_filter($dbQueues);
|
||||
$dbQueues = \array_values($dbQueues);
|
||||
|
||||
$count = $table->get('databases', 'workerCount');
|
||||
|
||||
Console::log('Database worker count: ' . $count);
|
||||
|
||||
$queue = $dbQueues[$count];
|
||||
} else {
|
||||
$queue = \trim($dbQueues);
|
||||
$project = new Document($this->args['project']);
|
||||
$queue = $project->getAttribute('database');
|
||||
}
|
||||
|
||||
\putenv('QUEUE=' . $queue);
|
||||
|
|
|
|||
Loading…
Reference in a new issue