Created
March 8, 2017 19:03
-
-
Save marr/18a8bdf89ca9aca67834f81bdd908e63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { call, spawn } from 'redux-saga/effects' | |
import { sagas as centreSagas } from './ducks/centres' | |
export default async function rootSaga() { | |
const sagas = [...centreSagas] | |
await sagas.map(saga => | |
spawn(async function () { | |
console.log(saga); | |
let isSyncError = false | |
while (!isSyncError) { | |
isSyncError = true | |
try { | |
setTimeout(() => { isSyncError = false }) | |
await call(saga) | |
} catch (e) { | |
if (isSyncError) { | |
throw new Error(saga.name + ' was terminated because it threw an exception on startup.') | |
} | |
// handle exceptions here | |
} | |
} | |
}) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment