JS Retry

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2020 Jul 24 5:32
Editor
Edited
Edited
2021 Apr 16 7:47
Tags
Tags

function

const RETRY_INTERVAL = 2000 export const retry = (func, args, max = 3, count = 0) => { if (count >= max) return "max try exeeded" try { return func(...args) } catch (e) { setTimeout(() => { file.set(`${func.name} ${++count}`, e.message) return retry(func, args, max, count) }, RETRY_INTERVAL) } }
 
 
 
 
 
 

Recommendations