Commit 8fa3b86fb955564d6e9a012e11dd8e7c9240a5e3

Authored by Adhidarma Hadiwinoto
1 parent 8437cc1ad1
Exists in master

penanganan nama untuk center heartbeat

Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff

... ... @@ -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