From 599159ecf0df3e5a59d2892aa59986ee1b2eefe5 Mon Sep 17 00:00:00 2001 From: softsimon Date: Wed, 29 Jul 2020 13:57:49 +0700 Subject: [PATCH] Fix: Don't build statistics cache when DB is disabled. --- backend/src/routes.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/routes.ts b/backend/src/routes.ts index c8ef0dca5..35e48457a 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -1,3 +1,4 @@ +const config = require('../mempool-config.json'); import { Request, Response } from 'express'; import statistics from './api/statistics'; import feeApi from './api/fee-api'; @@ -10,8 +11,10 @@ class Routes { private cache = {}; constructor() { - this.createCache(); - setInterval(this.createCache.bind(this), 600000); + if (!config.DB_DISABLED) { + this.createCache(); + setInterval(this.createCache.bind(this), 600000); + } } private async createCache() {