Commit aa18810cac8a9354011e82a586f70fb380f5fd77
1 parent
1c528f85fe
Exists in
master
move heartbeat
Showing 3 changed files with 30 additions and 30 deletions Side-by-side Diff
gateway/heartbeat.js
... | ... | @@ -1,29 +0,0 @@ |
1 | -"use strict"; | |
2 | - | |
3 | -const request = require('request'); | |
4 | - | |
5 | -const config = require('../config'); | |
6 | -const logger = require('../logger'); | |
7 | -const matrix = require('../matrix'); | |
8 | - | |
9 | -function sendHeartbeat() { | |
10 | - if (!config || !config.core_url) { return; } | |
11 | - | |
12 | - const requestOptions = { | |
13 | - url: config.core_url + '/heartbeats', | |
14 | - form: { | |
15 | - name: config.handler_name, | |
16 | - module_type: 'gateway', | |
17 | - config: JSON.stringify(config), | |
18 | - matrix: JSON.stringify(matrix) | |
19 | - } | |
20 | - } | |
21 | - | |
22 | - request.post(requestOptions); | |
23 | -} | |
24 | - | |
25 | -sendHeartbeat(); | |
26 | -setInterval( | |
27 | - sendHeartbeat, | |
28 | - 60 * 1000 | |
29 | -) |
gateway/pull.js
... | ... | @@ -6,7 +6,7 @@ const config = require('../config'); |
6 | 6 | const logger = require('../logger'); |
7 | 7 | const matrix = require('../matrix'); |
8 | 8 | const controlPanel = require('../control-panel'); |
9 | -const heartbeat = require('./heartbeat'); | |
9 | +const heartbeat = require('../heartbeat'); | |
10 | 10 | |
11 | 11 | var partner; |
12 | 12 |
heartbeat.js
... | ... | @@ -0,0 +1,29 @@ |
1 | +"use strict"; | |
2 | + | |
3 | +const request = require('request'); | |
4 | + | |
5 | +const config = require('./config'); | |
6 | +const logger = require('./logger'); | |
7 | +const matrix = require('./matrix'); | |
8 | + | |
9 | +function sendHeartbeat() { | |
10 | + if (!config || !config.core_url) { return; } | |
11 | + | |
12 | + const requestOptions = { | |
13 | + url: config.core_url + '/heartbeats', | |
14 | + form: { | |
15 | + name: config.handler_name, | |
16 | + module_type: 'gateway', | |
17 | + config: JSON.stringify(config), | |
18 | + matrix: JSON.stringify(matrix) | |
19 | + } | |
20 | + } | |
21 | + | |
22 | + request.post(requestOptions); | |
23 | +} | |
24 | + | |
25 | +sendHeartbeat(); | |
26 | +setInterval( | |
27 | + sendHeartbeat, | |
28 | + 60 * 1000 | |
29 | +) |