Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
French Tax and Benefit Tables
baremes-ipp-views
Commits
4e31cfbf
Commit
4e31cfbf
authored
Oct 24, 2018
by
Florian Pagnoux
Browse files
Fail after 3 tries
parent
407ddb89
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/resolver.js
View file @
4e31cfbf
...
...
@@ -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
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment