diff --git a/src/bridge/BridgeSyncContext.js b/src/bridge/BridgeSyncContext.js index 8dbe2685..e0ddf61b 100644 --- a/src/bridge/BridgeSyncContext.js +++ b/src/bridge/BridgeSyncContext.js @@ -13,6 +13,7 @@ import { } from 'reducers/bridgeSync' import type { BridgeSyncState } from 'reducers/bridgeSync' import { accountsSelector } from 'reducers/accounts' +import { SYNC_BOOT_DELAY, SYNC_INTERVAL } from 'config/constants' import { getBridgeForCurrency } from '.' // Unify the synchronization management for bridges with the redux store @@ -153,9 +154,9 @@ class Provider extends Component { } catch (e) { logger.error('sync issues', e) } - setTimeout(syncLoop, 10 * 1000) + setTimeout(syncLoop, SYNC_INTERVAL) } - setTimeout(syncLoop, 2 * 1000) + setTimeout(syncLoop, SYNC_BOOT_DELAY) } // TODO we might want to call sync straight away when new accounts got added (it will happen every 10s anyway) diff --git a/src/components/EnsureDeviceApp/index.js b/src/components/EnsureDeviceApp/index.js index 4fed6072..6b237512 100644 --- a/src/components/EnsureDeviceApp/index.js +++ b/src/components/EnsureDeviceApp/index.js @@ -11,8 +11,7 @@ import type { State as StoreState } from 'reducers/index' import getAddress from 'commands/getAddress' import isCurrencyAppOpened from 'commands/isCurrencyAppOpened' -const CHECK_APP_INTERVAL_WHEN_INVALID = 300 -const CHECK_APP_INTERVAL_WHEN_VALID = 1000 +import { CHECK_APP_INTERVAL_WHEN_VALID, CHECK_APP_INTERVAL_WHEN_INVALID } from 'config/constants' type OwnProps = { currency?: ?CryptoCurrency, diff --git a/src/config/constants.js b/src/config/constants.js index aab97216..82762d5b 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -1,3 +1,9 @@ +// @flow + +export const SYNC_BOOT_DELAY = 5 * 1000 +export const SYNC_INTERVAL = 30 * 1000 +export const CHECK_APP_INTERVAL_WHEN_INVALID = 600 +export const CHECK_APP_INTERVAL_WHEN_VALID = 1200 export const CHECK_UPDATE_DELAY = 5e3 export const MODAL_ADD_ACCOUNT = 'MODAL_ADD_ACCOUNT'