From 928590b1750c099b4ba7293c7c2d3f5cf2a2cdc7 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 26 Nov 2024 16:20:11 +1300 Subject: [PATCH] Only create databases for current region --- app/http.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/http.php b/app/http.php index c80fccee54..e276dac519 100644 --- a/app/http.php +++ b/app/http.php @@ -264,9 +264,15 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg $sharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES_V1', '')); $sharedTablesV2 = \array_diff($sharedTables, $sharedTablesV1); + $region = System::getEnv('_APP_REGION', 'fra'); $cache = $app->getResource('cache'); - foreach ($sharedTablesV2 as $hostname) { + $regionDatabases = \array_filter( + $sharedTablesV2, + fn ($hostname) => \str_contains($hostname, $region) + ); + + foreach ($regionDatabases as $hostname) { $adapter = $pools ->get($hostname) ->pop()