@opuscapita/config
Advanced tools
Comparing version 3.0.18 to 3.0.20
@@ -63,3 +63,3 @@ const EventEmitter = require('events'); | ||
await Promise.all([ | ||
this._watchServices(consul, (allServices) => Promise.all(allServices.map((serviceName) => this._watchServiceHealth(consul, serviceName))).catch(e => this.logger.error(e))), | ||
//this._watchServices(consul, (allServices) => Promise.all(allServices.map((serviceName) => this._watchServiceHealth(consul, serviceName))).catch(e => this.logger.error(e))), | ||
this._watchKey(consul, this.serviceName + '/') | ||
@@ -82,5 +82,12 @@ ]); | ||
for(const k in this.epWatches) | ||
{ | ||
this.epWatches[k].removeAllListeners('change').removeAllListeners('error'); | ||
this.epWatches[k].end(); | ||
} | ||
for(const k in this.keyWatches) | ||
{ | ||
this.keyWatches[k].removeAllListeners('change').removeAllListeners('error'); | ||
this.keyWatches[k].end(); | ||
} | ||
@@ -147,3 +154,3 @@ this.epWatches = { }; | ||
watch.on('change', (data, res) => callback(Object.keys(data))); | ||
watch.on('error', (err) => reject(err)); | ||
watch.once('error', (err) => reject(err)); | ||
@@ -173,3 +180,3 @@ resolve(watch); | ||
watch.on('error', (err) => reject(err)); | ||
watch.once('error', (err) => reject(err)); | ||
watch.on('change', async (items) => | ||
@@ -213,4 +220,4 @@ { | ||
{ | ||
// if(this.keyWatches[key]) | ||
// return resolve(this.keyWatches[key]); | ||
if(this.keyWatches[key]) | ||
return resolve(this.keyWatches[key]); | ||
@@ -221,3 +228,3 @@ const watch = consul.watch({ method : consul.kv.keys, options : { key : key } }); | ||
watch.on('error', (err) => reject(err)); | ||
watch.once('error', (err) => reject(err)); | ||
watch.on('change', (keys) => | ||
@@ -230,7 +237,8 @@ { | ||
{ | ||
// if(this.keyWatches[key]) | ||
// this.keyWatches[key].end(); | ||
if(this.keyWatches[key]) | ||
this.keyWatches[key].end(); | ||
delete this.keyWatches[key]; | ||
delete this.knownKeys[key]; | ||
await this.cache.delete(key); | ||
@@ -241,4 +249,5 @@ | ||
this.emit('propertyChanged', shortKey); | ||
})); | ||
})).catch(e => null); | ||
Promise.all(keys.map(async (key) => | ||
@@ -268,3 +277,3 @@ { | ||
} | ||
})); | ||
})).catch(e => null); | ||
}); | ||
@@ -271,0 +280,0 @@ |
{ | ||
"name": "@opuscapita/config", | ||
"version": "3.0.18", | ||
"version": "3.0.20", | ||
"description": "Configuration API connector module for OpusCapita Business Network Portal.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38091
665