fetch subs fix

Instead of calling check subscriptions after fetching them (with a timeout hack), do this directly in the fetch routine instead of calling claim_list_by_channel. This ensures claim_list_by_channel is only called once and the subscriptions are checked after every fetch.
This commit is contained in:
Thomas Zarebczan 2018-11-30 13:59:36 -05:00
parent e9e2fc40d7
commit 1b92cb4d1e

View file

@ -102,7 +102,7 @@ export const doFetchMySubscriptions = () => (dispatch: ReduxDispatch, getState:
});
dispatch(doResolveUris(subscriptions.map(({ uri }) => uri)));
subscriptions.forEach(({ uri }) => dispatch(doFetchClaimsByChannel(uri, 1)));
dispatch(doCheckSubscriptions());
})
.catch(() => {
dispatch({
@ -401,7 +401,6 @@ export const doCheckSubscriptionsInit = () => (dispatch: ReduxDispatch) => {
// setTimeout below is a hack to ensure redux is hydrated when subscriptions are checked
// this will be replaced with <PersistGate> which reqiures a package upgrade
setTimeout(() => dispatch(doFetchMySubscriptions()), 5000);
setTimeout(() => dispatch(doCheckSubscriptions()), 10000);
const checkSubscriptionsTimer = setInterval(
() => dispatch(doCheckSubscriptions()),
CHECK_SUBSCRIPTIONS_INTERVAL