Distinguish betweek - permanent TCP check disable and pausing tcp check

This commit is contained in:
Praneeth Bodduluri 2015-08-26 19:57:26 +05:30 committed by Pablo Carranza Vélez
parent 03299d77f5
commit d6b6d2d73b

View File

@ -66,15 +66,19 @@ networkPattern =
exports.blink = blink
exports.pauseCheck = pauseCheck = false
pauseConnectivityCheck = false
disableConnectivityCheck = false
# options: An object of net.connect options, with the addition of:
# timeout: 10s
checkHost = (options) ->
new Promise (resolve, reject) ->
if exports.pauseCheck
if disableConnectivityCheck
resolve()
else
reject()
if pauseConnectivityCheck
resolve()
else
reject()
.then ->
return true
.catch ->
@ -83,8 +87,13 @@ checkHost = (options) ->
customMonitor = (options, fn) ->
networkCheck.monitor(checkHost, options, fn)
# pause: A Boolean to pause the connectivity checks
exports.pauseCheck = (pause) ->
pauseConnectivityCheck = pause
# disable: A Boolean to disable the connectivity checks
exports.disableCheck = (disable) ->
exports.pauseCheck=disable
disableConnectivityCheck = disable
exports.connectivityCheck = _.once ->
parsedUrl = url.parse(config.apiEndpoint)