@logzio-node-toolbox/consul
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -59,3 +59,3 @@ import retry from 'async-retry'; | ||
this.keyPrefix = baseUrl ? `${baseUrl.replace(/\/*$/, '')}/` : ''; | ||
this.didIgnoreFisrt = false; | ||
this.didIgnorePaths = {}; | ||
this.connectionParams = { | ||
@@ -161,10 +161,11 @@ host, | ||
}; | ||
this.didIgnorePaths[key] = false; | ||
const watcher = this.consulInstance.watch(watchOptions); | ||
if (!ignoreFirst) this.didIgnoreFisrt = true; | ||
this.get(key).then(data => !data ? this.didIgnoreFisrt = true : '').catch(() => this.didIgnoreFisrt = true); | ||
if (!ignoreFirst) this.didIgnorePaths[key] = true; | ||
this.get(key).then(data => !data ? this.didIgnorePaths[key] = true : '').catch(() => this.didIgnorePaths[key] = true); | ||
watcher.on('change', data => { | ||
if (this.didIgnoreFisrt && data) { | ||
if (this.didIgnorePaths[key] && data) { | ||
onChange(parseValue(data)); | ||
} else if (data) { | ||
this.didIgnoreFisrt = true; | ||
this.didIgnorePaths[key] = true; | ||
} | ||
@@ -171,0 +172,0 @@ }); |
{ | ||
"name": "@logzio-node-toolbox/consul", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Consul easy use for json configs and service discovery", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs", |
Sorry, the diff of this file is not supported yet
77477
2137