vault-high-availability
Advanced tools
Comparing version 1.0.27 to 1.0.28
{ | ||
"name": "vault-high-availability", | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -42,20 +42,26 @@ 'use strict'; | ||
request.get((urlLib.format(urlWithIpObject)) + "v1/sys/leader", { | ||
timeout: 1000, | ||
timeout: 500, | ||
gzip: true | ||
}, function (error, response, body) { | ||
log.debug("leader response for ip: ", address, "body: ", body, "error: ", error); | ||
var jsonBody = null; | ||
try { | ||
jsonBody = JSON.parse(body); | ||
} catch (e) { | ||
log.debug("response wasn't in json format", body) | ||
if(error) { | ||
log.error("An error happened while trying to resolve vault dns",error); | ||
callbackAsync(); | ||
} | ||
else { | ||
log.debug("leader response for ip: ", address, "body: ", body, "error: ", error); | ||
var jsonBody = null; | ||
try { | ||
jsonBody = JSON.parse(body); | ||
} catch (e) { | ||
log.debug("response wasn't in json format", body) | ||
} | ||
if (response && response.statusCode === 200 && jsonBody && jsonBody.is_self === true) { | ||
log.info("leader found: ", address); | ||
newIp = address.address; | ||
} else { | ||
log.debug("not the leader: ", address); | ||
if (response && response.statusCode === 200 && jsonBody && jsonBody.is_self === true) { | ||
log.info("leader found: ", address); | ||
newIp = address.address; | ||
} else { | ||
log.debug("not the leader: ", address); | ||
} | ||
callbackAsync(); | ||
} | ||
callbackAsync(); | ||
}); | ||
@@ -62,0 +68,0 @@ }, |
31369
601