Switch to monitoring if the host is reachable via tcp, rather than a using a full http request.

This commit is contained in:
Pagan Gazzard 2015-03-17 20:40:57 +00:00 committed by Pablo Carranza Vélez
parent a97cd40b44
commit c29e0720c6
3 changed files with 7 additions and 5 deletions

View File

@ -17,7 +17,7 @@
"knex": "~0.7.3",
"lodash": "^3.0.0",
"mixpanel": "0.0.20",
"network-checker": "~0.0.2",
"network-checker": "~0.0.3",
"ngrok": "~0.1.97",
"pinejs-client": "^1.2.0",
"pubnub": "~3.6.4",

View File

@ -24,8 +24,6 @@ module.exports = config =
appUpdatePollInterval: checkInt(process.env.APPLICATION_UPDATE_POLL_INTERVAL) ? 60000
successMessage: 'SUPERVISOR OK'
config.heartbeatEndpoint = config.apiEndpoint + '/ping'
config.supervisorContainer =
Volumes:
'/boot/config.json': {}

View File

@ -5,6 +5,7 @@ config = require './config'
mixpanel = require 'mixpanel'
networkCheck = require 'network-checker'
blink = require('blinking')(config.ledFile)
url = require 'url'
utils = exports
@ -64,9 +65,12 @@ networkPattern =
pause: 1000
exports.blink = blink
exports.connectivityCheck = _.once ->
networkCheck.monitorURL
url: config.heartbeatEndpoint
parsedUrl = url.parse(config.apiEndpoint)
networkCheck.monitorHost
host: parsedUrl.hostname
port: parsedUrl.port ? (if parsedUrl.protocol is 'https:' then 443 else 80)
interval: 10 * 1000
(connected) ->
if connected