MCPcopy
hub / github.com/langgenius/dify / fetchTextWithRetry

Function fetchTextWithRetry

packages/dev-proxy/src/cli.spec.ts:92–107  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

90})
91
92const fetchTextWithRetry = async (url: string) => {
93 let lastError: unknown
94
95 for (let attempt = 0; attempt < 10; attempt += 1) {
96 try {
97 const response = await fetch(url)
98 return response.text()
99 }
100 catch (error) {
101 lastError = error
102 await new Promise(resolve => setTimeout(resolve, 50))
103 }
104 }
105
106 throw lastError
107}
108
109const spawnCli = (args: readonly string[], cwd: string) => {
110 const child = spawn(process.execPath, [binPath, ...args], {

Callers 1

cli.spec.tsFile · 0.85

Calls 2

fetchFunction · 0.85
textMethod · 0.45

Tested by

no test coverage detected