Creates an Effect description that instructs the middleware to call the
function fn with args as arguments. In case of failure will try to make
another call after delay milliseconds, if a number of attempts < maxTries.
Example
In the following example, we create a basic task retrySaga. We use retry
to try to fetch our API 3 times with 10 second interval. If request fails
first time than retry will call request one more time while calls count
less than 3.
import { put, retry } from 'redux-saga/effects'
import { request } from 'some-api';
Creates an Effect description that instructs the middleware to call the function
fnwithargsas arguments. In case of failure will try to make another call afterdelaymilliseconds, if a number of attempts <maxTries.Example
In the following example, we create a basic task
retrySaga. We useretryto try to fetch our API 3 times with 10 second interval. Ifrequestfails first time thanretrywill callrequestone more time while calls count less than 3.import { put, retry } from 'redux-saga/effects' import { request } from 'some-api';
function* retrySaga(data) { try { const SECOND = 1000 const response = yield retry(3, 10 * SECOND, request, data) yield put({ type: 'REQUEST_SUCCESS', payload: response }) } catch(error) { yield put({ type: 'REQUEST_FAIL', payload: { error } }) } }