Compare View
Commits (3)
Changes
Showing 2 changed files Side-by-side Diff
heartbeat.js
... | ... | @@ -11,11 +11,21 @@ let module_type; |
11 | 11 | function sendHeartbeat() { |
12 | 12 | if (!config || !config.core_url || !module_type) { return; } |
13 | 13 | |
14 | + let heartbeat_name = config.handler_name || config.origin; | |
15 | + if (config.username) { | |
16 | + heartbeat_name += '/' + config.username; | |
17 | + } | |
18 | + | |
19 | + if (!heartbeat_name) { | |
20 | + logger.warn('Unknown heartbeat name, skip sending heartbeat'); | |
21 | + return; | |
22 | + } | |
23 | + | |
14 | 24 | const requestOptions = { |
15 | 25 | uri: config.core_url + '/heartbeats', |
16 | 26 | method: 'POST', |
17 | 27 | json: { |
18 | - name: config.handler_name, | |
28 | + name: heartbeat_name, | |
19 | 29 | module_type: module_type, |
20 | 30 | config: config, |
21 | 31 | matrix: matrix |
... | ... | @@ -31,6 +41,7 @@ setInterval( |
31 | 41 | ) |
32 | 42 | |
33 | 43 | function setModuleType(value) { |
44 | + logger.verbose('Set heartbeat module type as ' + value + ' and starting to send heartbeat per interval'); | |
34 | 45 | module_type = value; |
35 | 46 | sendHeartbeat(); |
36 | 47 | } |