From 9734052477dff2e59c04c43b93576a3afb946443 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Wed, 15 Feb 2023 17:45:29 +0900 Subject: [PATCH] Fix database used when database disabled --- backend/src/api/pools-parser.ts | 2 +- backend/src/index.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts index c3cc994a2..e37414bbe 100644 --- a/backend/src/api/pools-parser.ts +++ b/backend/src/api/pools-parser.ts @@ -127,7 +127,7 @@ class PoolsParser { if (!equals(JSON.parse(existingPool.addresses), poolObj.addresses) || !equals(JSON.parse(existingPool.regexes), poolObj.regexes)) { finalPoolDataUpdate.push(poolObj); } - } else { + } else if (config.DATABASE.ENABLED) { // Double check that if we're not just renaming a pool (same address same regex) const [poolToRename]: any[] = await DB.query(` SELECT * FROM pools diff --git a/backend/src/index.ts b/backend/src/index.ts index cad675e27..a81275066 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -105,7 +105,9 @@ class Server { .use(express.text({ type: ['text/plain', 'application/base64'] })) ; - await priceUpdater.$initializeLatestPriceWithDb(); + if (config.DATABASE.ENABLED) { + await priceUpdater.$initializeLatestPriceWithDb(); + } this.server = http.createServer(this.app); this.wss = new WebSocket.Server({ server: this.server });