Skip to content

Commit

Permalink
fix inifinte loop with invalid hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
arnesetzer committed Jul 25, 2024
1 parent 9c580a9 commit 1b113f0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/request_urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ function request_urls(config, urls, callback) {
requestOpts.url = url + `&${key.keyName}=${key.value}`;
}

request( requestOpts, function ( err, res ){
if( err ){
console.error( err );
urls.push(url);
request(requestOpts, function (err, res) {
if (err) {
console.error(err);
//Check if hostname is valid. Abort execution if not
if (err.code === 'ENOTFOUND') {
throw new Error('Invalid hostname, exiting');
}
else {
urls.push(url);
}
else if( shouldRetryRequest(res) ){
urls.push(url);
Expand Down

0 comments on commit 1b113f0

Please sign in to comment.