Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
723 B
Text
25 lines
723 B
Text
/* IMPORT */
|
|
/* MAIN */
|
|
const retryifySync = (fn, options) => {
|
|
const { isRetriable } = options;
|
|
return function retryified(options) {
|
|
const { timeout } = options;
|
|
const timestamp = Date.now() + timeout;
|
|
return function attempt(...args) {
|
|
while (true) {
|
|
try {
|
|
return fn.apply(undefined, args);
|
|
}
|
|
catch (error) {
|
|
if (!isRetriable(error))
|
|
throw error;
|
|
if (Date.now() >= timestamp)
|
|
throw error;
|
|
continue;
|
|
}
|
|
}
|
|
}; //TSC
|
|
};
|
|
};
|
|
/* EXPORT */
|
|
export default retryifySync;
|