mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
perf: load plugin groups code;perf: system plugin schema;fix: special variables replace;perf: retry cron app job (#3347)
* perf: load plugin groups code * perf: system plugin schema * feat: retry cron app job * fix: special variables replace
This commit is contained in:
@@ -4,3 +4,15 @@ export const delay = (ms: number) =>
|
||||
resolve('');
|
||||
}, ms);
|
||||
});
|
||||
|
||||
export const retryFn = async <T>(fn: () => Promise<T>, retryTimes = 3): Promise<T> => {
|
||||
try {
|
||||
return fn();
|
||||
} catch (error) {
|
||||
if (retryTimes > 0) {
|
||||
await delay(500);
|
||||
return retryFn(fn, retryTimes - 1);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user