From 5d845208d9494930c3471ef106bdbe1e613a54d6 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 12 Oct 2023 15:02:53 +1300 Subject: [PATCH] Simplify --- .env | 3 +-- bin/worker-databases | 16 +--------------- docker-compose.yml | 3 +-- src/Appwrite/Event/Database.php | 13 ++++--------- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/.env b/.env index 4777d7fdcb..0e5da80955 100644 --- a/.env +++ b/.env @@ -4,8 +4,7 @@ _APP_WORKER_PER_CORE=6 _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_CONNECTIONS_DB_QUEUE=database-db-main _APP_SYSTEM_EMAIL_NAME=Appwrite _APP_SYSTEM_EMAIL_ADDRESS=team@appwrite.io _APP_SYSTEM_SECURITY_EMAIL_ADDRESS=security@appwrite.io diff --git a/bin/worker-databases b/bin/worker-databases index 6f27d3d13e..364ffaa90b 100644 --- a/bin/worker-databases +++ b/bin/worker-databases @@ -7,18 +7,4 @@ else REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" fi -queues="${_APP_CONNECTIONS_DB_QUEUES}" -if [ -z "${queues}" ]; then - queues="v1-databases" -fi - -count=1 -if [ "${_APP_CONNECTIONS_QUEUE_PER_WORKER}" = "enabled" ]; then - count=$(echo "${queues}" | tr ',' '\n' | wc -l) -fi - -INTERVAL=0.1 \ - QUEUE="${queues}" \ - COUNT=${count} \ - APP_INCLUDE='/usr/src/code/app/workers/databases.php' \ - php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php +INTERVAL=0.1 QUEUE="${_APP_CONNECTIONS_DB_QUEUE}" APP_INCLUDE="/usr/src/code/app/workers/databases.php" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php diff --git a/docker-compose.yml b/docker-compose.yml index e231f4d7d2..8e7c392ac5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -366,8 +366,7 @@ services: - mariadb environment: - _APP_ENV - - _APP_CONNECTIONS_QUEUE_PER_WORKER - - _APP_CONNECTIONS_DB_QUEUES + - _APP_CONNECTIONS_DB_QUEUE - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_REDIS_HOST diff --git a/src/Appwrite/Event/Database.php b/src/Appwrite/Event/Database.php index f36688eb01..81e032eacd 100644 --- a/src/Appwrite/Event/Database.php +++ b/src/Appwrite/Event/Database.php @@ -15,15 +15,10 @@ class Database extends Event public function __construct() { - $dbQueues = App::getEnv('_APP_CONNECTIONS_DB_QUEUES'); - - if (empty($dbQueues)) { - $queue = Event::DATABASE_QUEUE_NAME; - } else { - $queue = $this->getProject()->getAttribute('database'); - } - - parent::__construct($queue, Event::DATABASE_CLASS_NAME); + parent::__construct( + $this->getProject()->getAttribute('database'), + Event::DATABASE_CLASS_NAME + ); } /**