mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-01 00:45:23 +00:00
Distinguish betweek - permanent TCP check disable and pausing tcp check
This commit is contained in:
parent
03299d77f5
commit
d6b6d2d73b
@ -66,15 +66,19 @@ networkPattern =
|
|||||||
|
|
||||||
exports.blink = blink
|
exports.blink = blink
|
||||||
|
|
||||||
exports.pauseCheck = pauseCheck = false
|
pauseConnectivityCheck = false
|
||||||
|
disableConnectivityCheck = false
|
||||||
# options: An object of net.connect options, with the addition of:
|
# options: An object of net.connect options, with the addition of:
|
||||||
# timeout: 10s
|
# timeout: 10s
|
||||||
checkHost = (options) ->
|
checkHost = (options) ->
|
||||||
new Promise (resolve, reject) ->
|
new Promise (resolve, reject) ->
|
||||||
if exports.pauseCheck
|
if disableConnectivityCheck
|
||||||
resolve()
|
resolve()
|
||||||
else
|
else
|
||||||
reject()
|
if pauseConnectivityCheck
|
||||||
|
resolve()
|
||||||
|
else
|
||||||
|
reject()
|
||||||
.then ->
|
.then ->
|
||||||
return true
|
return true
|
||||||
.catch ->
|
.catch ->
|
||||||
@ -83,8 +87,13 @@ checkHost = (options) ->
|
|||||||
customMonitor = (options, fn) ->
|
customMonitor = (options, fn) ->
|
||||||
networkCheck.monitor(checkHost, 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.disableCheck = (disable) ->
|
||||||
exports.pauseCheck=disable
|
disableConnectivityCheck = disable
|
||||||
|
|
||||||
exports.connectivityCheck = _.once ->
|
exports.connectivityCheck = _.once ->
|
||||||
parsedUrl = url.parse(config.apiEndpoint)
|
parsedUrl = url.parse(config.apiEndpoint)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user