Last active
September 9, 2017 19:50
-
-
Save Calvin-Huang/df5f4cecc2e98343c48a7d317ab69891 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
// Retry 5 times without waiting | |
const inputEpic = (action$) => | |
action$.ofType('INPUT_CHANGED') | |
.retry(5) | |
... | |
// Retry 5 times with waiting for 2 seconds | |
const inputEpic = (action$) => | |
action$.ofType('INPUT_CHANGED') | |
.retryWhen(function(errors) { | |
return errors | |
.delay(2000) | |
.scan((errorCount, err) => { | |
if(errorCount >= 5) { | |
throw err; | |
} | |
return errorCount + 1; | |
}, 0); | |
}) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment