Commit 458d9668 authored by Suhaimi Amir's avatar Suhaimi Amir

dont subscribe by default

parent 828077e2
Pipeline #1089 passed with stage
in 34 seconds
......@@ -2,7 +2,7 @@ const configServer = require('cote-requester')('config', 'Config Lib : Reqs');
const cote = require('cote');
const logger = require('logger');
const configSubscriber = new cote.Subscriber({ name: 'Config Lib : Subs', key: 'config' });
let configSubscriber = null;
exports.get = async (name) => {
setTimeout(() => {
......@@ -36,6 +36,10 @@ exports.get = async (name) => {
// check if config has changed
exports.onChange = (name, filesToUncache = []) => {
if (configSubscriber === null) { // only run if we're listening to changes
configSubscriber = new cote.Subscriber({ name: 'Config Lib : Subs', key: 'config' });
}
configSubscriber.on('config.update', (config, cb) => {
if (config.name === name) {
logger.info('Config file has been updated...');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment