Commit 4e31cfbf authored by Florian Pagnoux's avatar Florian Pagnoux
Browse files

Fail after 3 tries

parent 407ddb89
......@@ -55,12 +55,16 @@ async function resolveParam(key) {
return Object.assign({}, param, { subparams: resolvedChildren })
}
async function fetchParam(key) {
async function fetchParam(key, previousTries = 0) {
try {
const response = await fetch(`http://localhost:2000/parameter/${key}`)
return await response.json()
} catch (error) { // Try again, to deal with Mac race-conditions
return fetchParam(key)
if (previousTries <= 2) {
return fetchParam(key, previousTries = previousTries + 1)
} else {
throw error
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment