Answer the question
In order to leave comments, you need to log in
How to terminate the process if the proxy server is unavailable?
It is necessary to somehow catch bad proxies and set timeout when requesting a URL
. I do it as follows
let options ={
request: {
uri: 'https://google.com/',
json: true,
timeout: 1500,
proxy: 'https://ip:port/',
headers: {
'User-Agent': config.api.userAgent
}
}
};
request.get(options.request, (e, data) => {
console.log(e);
process.exit(0);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question