From f3c18b152abc4872ca0f7cb4cde10e0a45adb9a0 Mon Sep 17 00:00:00 2001 From: softsimon Date: Sat, 30 Jan 2021 22:12:22 +0700 Subject: [PATCH] Moved sponsors cache creation until after diskcache is done. refs #315 --- backend/src/api/donations.ts | 9 ++------- backend/src/index.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/src/api/donations.ts b/backend/src/api/donations.ts index 580ae3a90..32700baae 100644 --- a/backend/src/api/donations.ts +++ b/backend/src/api/donations.ts @@ -16,14 +16,9 @@ class Donations { sponsorsCache: any[] = []; - constructor() { - if (!config.SPONSORS.ENABLED) { - return; - } - this.$updateCache(); - } + constructor() {} - async $updateCache() { + public async $updateCache() { try { this.sponsorsCache = await this.$getDonationsFromDatabase('handle, image'); } catch (e) { diff --git a/backend/src/index.ts b/backend/src/index.ts index 206c8ef8e..e78691aed 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -85,12 +85,16 @@ class Server { statistics.startStatistics(); } + fiatConversion.startService(); + + if (config.SPONSORS.ENABLED) { + donations.$updateCache(); + } + this.setUpHttpApiRoutes(); this.setUpWebsocketHandling(); this.runMainUpdateLoop(); - fiatConversion.startService(); - if (config.BISQ_BLOCKS.ENABLED) { bisq.startBisqService(); bisq.setPriceCallbackFunction((price) => websocketHandler.setExtraInitProperties('bsq-price', price));