Skip to content

Commit ea61559

Browse files
committed
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
1 parent 2d6c94f commit ea61559

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ MAX_FETCH_JOBS=1000
1515
INSTANCE_NAME=Myrient
1616
# Enable the built-in emulator
1717
EMULATOR_ENABLED=true
18+
# Enable database keyword optimizer
19+
DB_KEYWORD_OPTIMIZER=0
1820
# Set the hostname
1921
HOSTNAME=myrient.mahou.one
2022

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ services:
1616
- MAX_FETCH_JOBS=1000
1717
- INSTANCE_NAME=Myrient
1818
- EMULATOR_ENABLED=true
19+
- DB_KEYWORD_OPTIMIZER=0
1920
- POSTGRES_HOST=postgres
2021
- POSTGRES_PORT=5432
2122
- POSTGRES_DB=myrient

server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ async function getFilesJob() {
101101
metadataMatchCount = await File.count({
102102
where: { detailsId: { [Op.ne]: null } },
103103
});
104-
await optimizeDatabaseKws();
104+
if(process.env.DB_KEYWORD_OPTIMIZER === "1"){
105+
await optimizeDatabaseKws();
106+
}
105107
}
106108
//this is less important and needs to run last.
107109
if (fileCount > oldFileCount && (await Metadata.count())) {
@@ -132,6 +134,7 @@ async function updateMetadata() {
132134

133135
async function updateKws() {
134136
if (updatingFiles) return;
137+
if (process.env.DB_KEYWORD_OPTIMIZER !== "1") return;
135138
if (!(await File.count({ where: { filenamekws: { [Op.ne]: null } } })) || process.env.FORCE_DB_OPTIMIZE == "1") {
136139
await optimizeDatabaseKws();
137140
}

0 commit comments

Comments
 (0)