From ea61559f104c7689f3169fa4d5816a6663d48605 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 20 Oct 2025 20:17:07 -0600 Subject: [PATCH] add db kw optimizer env and disable by default until I get off my ass and actually fix the memory usage problems and postgres pagination issues, hey wait shouldn't this be in an issue and not a commit? Oh well --- .env | 2 ++ docker-compose.yml | 1 + server.js | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 170a182..5d09731 100644 --- a/.env +++ b/.env @@ -15,6 +15,8 @@ MAX_FETCH_JOBS=1000 INSTANCE_NAME=Myrient # Enable the built-in emulator EMULATOR_ENABLED=true +# Enable database keyword optimizer +DB_KEYWORD_OPTIMIZER=0 # Set the hostname HOSTNAME=myrient.mahou.one diff --git a/docker-compose.yml b/docker-compose.yml index 435cfee..a928af2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: - MAX_FETCH_JOBS=1000 - INSTANCE_NAME=Myrient - EMULATOR_ENABLED=true + - DB_KEYWORD_OPTIMIZER=0 - POSTGRES_HOST=postgres - POSTGRES_PORT=5432 - POSTGRES_DB=myrient diff --git a/server.js b/server.js index 796b761..70fce61 100644 --- a/server.js +++ b/server.js @@ -101,7 +101,9 @@ async function getFilesJob() { metadataMatchCount = await File.count({ where: { detailsId: { [Op.ne]: null } }, }); - await optimizeDatabaseKws(); + if(process.env.DB_KEYWORD_OPTIMIZER === "1"){ + await optimizeDatabaseKws(); + } } //this is less important and needs to run last. if (fileCount > oldFileCount && (await Metadata.count())) { @@ -132,6 +134,7 @@ async function updateMetadata() { async function updateKws() { if (updatingFiles) return; + if (process.env.DB_KEYWORD_OPTIMIZER !== "1") return; if (!(await File.count({ where: { filenamekws: { [Op.ne]: null } } })) || process.env.FORCE_DB_OPTIMIZE == "1") { await optimizeDatabaseKws(); }