kopia lustrzana https://github.com/badgen/badgen.net
feat: fail fast (timeout 12000 => 6000)
rodzic
e744c081d3
commit
506d06bedf
|
@ -1,7 +1,7 @@
|
|||
const axios = require('axios')
|
||||
|
||||
module.exports = axios.create({
|
||||
timeout: 12000,
|
||||
timeout: 6000,
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
|
|
|
@ -27,7 +27,10 @@ async function fetchLiveParams (scope, fn, paramsPath) {
|
|||
console.time(fetchKey)
|
||||
waitings[fetchKey] = fn(...paramsPath.split('/')).catch(e => {
|
||||
console.error(fetchKey, 'LIVE_ERROR', e.message)
|
||||
return { failed: true }
|
||||
return {
|
||||
failed: true,
|
||||
status: e.code === 'ECONNABORTED' ? 'timeout' : 'unknown'
|
||||
}
|
||||
}).then(result => {
|
||||
console.timeEnd(fetchKey)
|
||||
waitings[fetchKey] = undefined
|
||||
|
|
Ładowanie…
Reference in New Issue