Update index.js
- increased timeout up to 60 seconds - changed valid response status code range - removed errors type check
This commit is contained in:
parent
aad7f1c83d
commit
aea1f081c6
|
@ -5,7 +5,7 @@ const https = require('https')
|
||||||
const verbose = process.env.npm_config_debug || false
|
const verbose = process.env.npm_config_debug || false
|
||||||
const errorLog = 'error.log'
|
const errorLog = 'error.log'
|
||||||
const config = {
|
const config = {
|
||||||
timeout: 1000,
|
timeout: 60000,
|
||||||
delay: 200
|
delay: 200
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ const instance = axios.create({
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
}),
|
}),
|
||||||
validateStatus: function (status) {
|
validateStatus: function (status) {
|
||||||
return status >= 200 && status < 404
|
return status >= 200 && status < 400
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': '*/*',
|
'Accept': '*/*',
|
||||||
|
@ -81,13 +81,9 @@ async function test() {
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
||||||
if(err.response || (err.request && ['ENOTFOUND'].indexOf(err.code) > -1)) {
|
stats.failures++
|
||||||
|
|
||||||
stats.failures++
|
|
||||||
|
|
||||||
writeToLog(country.url, err.message, item.url)
|
writeToLog(country.url, err.message, item.url)
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue