Commit 7616bf2596787222ad693968c61a6889f5813f97

Authored by Adhidarma Hadiwinoto
1 parent a384705113
Exists in master

Touch matrix.systemd_notified on invoking sd-notify

Showing 1 changed file with 4 additions and 0 deletions Inline Diff

1 /* eslint-disable global-require */ 1 /* eslint-disable global-require */
2 /* eslint-disable import/no-extraneous-dependencies */ 2 /* eslint-disable import/no-extraneous-dependencies */
3 3
4 const MODULE_NAME = 'KOMODO-SDK.SD-NOTIFY'; 4 const MODULE_NAME = 'KOMODO-SDK.SD-NOTIFY';
5 5
6 const logger = require('tektrans-logger'); 6 const logger = require('tektrans-logger');
7 const matrix = require('./matrix');
7 8
8 module.exports = () => { 9 module.exports = () => {
9 try { 10 try {
10 const notify = require('sd-notify'); 11 const notify = require('sd-notify');
12
11 notify.ready(); 13 notify.ready();
14 matrix.systemd_notified = new Date();
15
12 logger.info(`${MODULE_NAME} 701F8400: Systemd ready notification has been sent`); 16 logger.info(`${MODULE_NAME} 701F8400: Systemd ready notification has been sent`);
13 } catch (e) { 17 } catch (e) {
14 logger.warn(`${MODULE_NAME} A6C99938: Optional dependency not found: sd-notify`); 18 logger.warn(`${MODULE_NAME} A6C99938: Optional dependency not found: sd-notify`);
15 } 19 }
16 }; 20 };
17 21