2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-25 11:20:02 +00:00
frappe_docker/build/frappe-socketio/health.js

20 lines
597 B
JavaScript
Raw Normal View History

2020-02-10 08:00:54 +00:00
var net = require('net');
var { get_conf } = require('./node_utils');
var conf = get_conf();
var server = ['localhost', conf.socketio_port || 9000];
var sock = new net.Socket();
sock.setTimeout(2500);
sock.on('connect', function() {
console.info(server[0]+':'+server[1]+' is up.');
sock.destroy();
process.exit();
}).on('error', function(e) {
console.error(server[0]+':'+server[1]+' is down: ' + e.message);
process.exit(1);
}).on('timeout', function(e) {
console.error(server[0]+':'+server[1]+' is down: timeout');
process.exit(1);
}).connect(server[1], server[0]);