MCPcopy
hub / github.com/labring/FastGPT / retryFn

Function retryFn

packages/global/common/system/utils.ts:8–20  ·  view source on GitHub ↗
(fn: () => Promise<T>, attempts = 3)

Source from the content-addressed store, hash-verified

6 });
7
8export const retryFn = async <T>(fn: () => Promise<T>, attempts = 3): Promise<T> => {
9 while (true) {
10 try {
11 return await fn();
12 } catch (error) {
13 if (attempts <= 0) {
14 return Promise.reject(error);
15 }
16 await delay(500);
17 attempts--;
18 }
19 }
20};
21
22export const withTimeout = async <T>(
23 promise: Promise<T>,

Callers 15

readFileRawTextByUrlFunction · 0.90
delCollectionFunction · 0.90
getVectorsFunction · 0.90
closeConnectionMethod · 0.90
mongoSessionRunFunction · 0.90
controller.tsFile · 0.90
recallFromVectorStoreFunction · 0.90
insertDatasetDataVectorFunction · 0.90
deleteDatasetDataVectorFunction · 0.90
MilvusCtrlClass · 0.90
setRedisCacheFunction · 0.90

Calls 3

rejectMethod · 0.80
delayFunction · 0.70
fnFunction · 0.50

Tested by

no test coverage detected