From 8f69f103e076d4970bb8608ad9200d84fe3ce471 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Thu, 16 Nov 2017 14:25:30 -0600 Subject: [PATCH] Set Bity Rates Polling Cycle to 30 Seconds --- common/sagas/swap/rates.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/sagas/swap/rates.ts b/common/sagas/swap/rates.ts index 1f31720e..640508b9 100644 --- a/common/sagas/swap/rates.ts +++ b/common/sagas/swap/rates.ts @@ -1,9 +1,12 @@ import { showNotification } from 'actions/notifications'; import { loadBityRatesSucceededSwap } from 'actions/swap'; +import { TypeKeys } from 'actions/swap/constants'; import { getAllRates } from 'api/bity'; import { delay, SagaIterator } from 'redux-saga'; import { call, cancel, fork, put, take, takeLatest } from 'redux-saga/effects'; +const POLLING_CYCLE = 30000; + export function* loadBityRates(): SagaIterator { while (true) { try { @@ -12,18 +15,18 @@ export function* loadBityRates(): SagaIterator { } catch (error) { yield put(showNotification('danger', error.message)); } - yield call(delay, 5000); + yield call(delay, POLLING_CYCLE); } } // Fork our recurring API call, watch for the need to cancel. function* handleBityRates(): SagaIterator { const loadBityRatesTask = yield fork(loadBityRates); - yield take('SWAP_STOP_LOAD_BITY_RATES'); + yield take(TypeKeys.SWAP_STOP_LOAD_BITY_RATES); yield cancel(loadBityRatesTask); } // Watch for latest SWAP_LOAD_BITY_RATES_REQUESTED action. export function* getBityRatesSaga(): SagaIterator { - yield takeLatest('SWAP_LOAD_BITY_RATES_REQUESTED', handleBityRates); + yield takeLatest(TypeKeys.SWAP_LOAD_BITY_RATES_REQUESTED, handleBityRates); }