diff --git a/backend/mempool-config.sample.json b/backend/mempool-config.sample.json index 0f265047f..00644c14c 100644 --- a/backend/mempool-config.sample.json +++ b/backend/mempool-config.sample.json @@ -11,7 +11,8 @@ "RECOMMENDED_FEE_PERCENTILE": 50, "BLOCK_WEIGHT_UNITS": 4000000, "INITIAL_BLOCKS_AMOUNT": 8, - "MEMPOOL_BLOCKS_AMOUNT": 8 + "MEMPOOL_BLOCKS_AMOUNT": 8, + "PRICE_FEED_UPDATE_INTERVAL": 3600 }, "CORE_RPC": { "HOST": "127.0.0.1", diff --git a/backend/src/api/fiat-conversion.ts b/backend/src/api/fiat-conversion.ts index 29006883a..0d242f3cd 100644 --- a/backend/src/api/fiat-conversion.ts +++ b/backend/src/api/fiat-conversion.ts @@ -1,6 +1,7 @@ import logger from '../logger'; import axios from 'axios'; import { IConversionRates } from '../mempool.interfaces'; +import config from '../config'; class FiatConversion { private conversionRates: IConversionRates = { @@ -16,7 +17,7 @@ class FiatConversion { public startService() { logger.info('Starting currency rates service'); - setInterval(this.updateCurrency.bind(this), 1000 * 60); + setInterval(this.updateCurrency.bind(this), 1000 * config.MEMPOOL.PRICE_FEED_UPDATE_INTERVAL); this.updateCurrency(); } diff --git a/backend/src/config.ts b/backend/src/config.ts index 399beff60..f690dba58 100644 --- a/backend/src/config.ts +++ b/backend/src/config.ts @@ -14,6 +14,7 @@ interface IConfig { BLOCK_WEIGHT_UNITS: number; INITIAL_BLOCKS_AMOUNT: number; MEMPOOL_BLOCKS_AMOUNT: number; + PRICE_FEED_UPDATE_INTERVAL: number; }; ESPLORA: { REST_API_URL: string; @@ -75,6 +76,7 @@ const defaults: IConfig = { 'BLOCK_WEIGHT_UNITS': 4000000, 'INITIAL_BLOCKS_AMOUNT': 8, 'MEMPOOL_BLOCKS_AMOUNT': 8, + 'PRICE_FEED_UPDATE_INTERVAL': 3600, }, 'ESPLORA': { 'REST_API_URL': 'http://127.0.0.1:3000',