function hb_check(node, container_port, container) { if (config.automatic_heartbeat.indexOf('enabled') > -1) { const client = config.ssl ? new tls.TLSSocket() : new net.Socket(); client.connect(container_port, node, container, () => {}); client.on('end', () => { addLog('\nA Heart Beat Check Just Ran.'); }); client.on('error', () => { addLog('\n' + container + ' failed on: ' + node); console.log('\n' + container + ' failed on: ' + node); if (config.container_host_constraints) { container_faillog.push(container); container_failover(container); } superagent .get(`${scheme}${server}:${server_port}/restart`) .query({ token: token, container }) .end((error, response) => { if (error) { console.log(error); } }); }); } }
? new TLSSocket() : new Socket(); socket.connect({ port: tcpOptions.port, host: tcpOptions.host }, () => { socket.setEncoding(tcpOptions.encoding); socket.setTimeout(tcpOptions.timeout);
function hb_check(node, container_port, container) { if (config.automatic_heartbeat.indexOf('enabled') > -1) { const client = config.ssl ? new tls.TLSSocket() : new net.Socket(); client.connect(container_port, node, container, () => {}); client.on('end', () => { addLog('\nA Heart Beat Check Just Ran.'); }); client.on('error', () => { addLog('\n' + container + ' failed on: ' + node); console.log('\n' + container + ' failed on: ' + node); if (config.container_host_constraints) { container_faillog.push(container); container_failover(container); } superagent .get(`${scheme}${server}:${server_port}/restart`) .query({ token: token, container }) .end((error, response) => { if (error) { console.log(error); } }); }); } }