Keeps trying to run task.
task
const task = (attempts) => { // attempts is number of times it has been retried if (Math.random() > 0.5) { // Return a succesful result return { success: true } } else { }}const t = await retryTask(task, opts); Copy
const task = (attempts) => { // attempts is number of times it has been retried if (Math.random() > 0.5) { // Return a succesful result return { success: true } } else { }}const t = await retryTask(task, opts);
Keeps trying to run
task
.