From 59fa84a31b3a0312ce0c7fd853ee69dc859f4bd4 Mon Sep 17 00:00:00 2001 From: Pedro Pablo Aste Kompen Date: Fri, 23 Apr 2021 11:59:07 -0400 Subject: [PATCH] Swaps: Add cache thresholds configuration (#2514) --- app/core/AppConstants.js | 5 ++++- app/core/Engine.js | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/core/AppConstants.js b/app/core/AppConstants.js index 8e7a51578fd..d0341617c51 100644 --- a/app/core/AppConstants.js +++ b/app/core/AppConstants.js @@ -61,7 +61,10 @@ export default { CLIENT_ID: 'mobile', LIVENESS_POLLING_FREQUENCY: 5 * 60 * 1000, POLL_COUNT_LIMIT: 3, - DEFAULT_SLIPPAGE: 3 + DEFAULT_SLIPPAGE: 3, + CACHE_AGGREGATOR_METADATA_THRESHOLD: 5 * 60 * 1000, + CACHE_TOKENS_THRESHOLD: 5 * 60 * 1000, + CACHE_TOP_ASSETS_THRESHOLD: 5 * 60 * 1000 }, MAX_SAFE_CHAIN_ID: 4503599627370476, URLS: { diff --git a/app/core/Engine.js b/app/core/Engine.js index 52d282d76f8..7062dfc9127 100644 --- a/app/core/Engine.js +++ b/app/core/Engine.js @@ -119,7 +119,12 @@ class Engine { new TokenRatesController(), new TransactionController(), new TypedMessageManager(), - new SwapsController({ clientId: AppConstants.SWAPS.CLIENT_ID }) + new SwapsController({ + clientId: AppConstants.SWAPS.CLIENT_ID, + fetchAggregatorMetadataThreshold: AppConstants.SWAPS.CACHE_AGGREGATOR_METADATA_THRESHOLD, + fetchTokensThreshold: AppConstants.SWAPS.CACHE_TOKENS_THRESHOLD, + fetchTopAssetsThreshold: AppConstants.SWAPS.CACHE_TOP_ASSETS_THRESHOLD + }) ], initialState );