Created
January 30, 2023 17:59
-
-
Save rutvikbhatt9/934221724dd09507a4b46d3f93a2ddf3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { RetryLink } from "@apollo/client/link/retry"; | |
const retryLink = new RetryLink({ | |
delay: { | |
initial: 5000, // milliseconds to wait before attempting the first retry | |
max: 10000, // milliseconds that the link should wait for any retry. | |
}, | |
attempts: { | |
max: 10, // number of times to try a single operation before giving up | |
retryIf: (error, _operation) => { | |
console.log("Error in retry", error.message) | |
if (error.message === 'Network request failed') { | |
console.log('RETRYING..............'); | |
// return true will attempt retry | |
return true; | |
} | |
// return false wil not attempt the request again | |
return false; | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment