@opuscapita/config
Advanced tools
Comparing version 3.1.13 to 3.1.14
@@ -342,10 +342,17 @@ const ConfigClientBase = require('./ConfigClientBase'); | ||
* @param {number} [timeout] - The maximum time in milliseconds to wait for the requested services to be available. | ||
* @returns {Promise} Returns a bluebird [Promise]{@link http://bluebirdjs.com/docs/api-reference.html} that gets rejected with an error if the passed timeout is reached. | ||
* @returns {Promise<boolean>} Returns a bluebird (promise) resolving to *true* if all requested services are available before the passed timeout is reached. | ||
*/ | ||
waitForEndpoints(serviceNames, timeout = 5000) { | ||
const _serviceNames = Array.isArray(serviceNames) ? serviceNames : [serviceNames]; | ||
return retry( | ||
() => this.getEndPoint(serviceNames, false). | ||
then(() => true), | ||
{interval: 500, backOff: 1.2, max_interval: timeout, max_tries: Number.MAX_SAFE_INTEGER, timeout: timeout} | ||
); | ||
(s) => Promise.all(s.map(k => this._getConsulEndpoint(k))), | ||
{ | ||
'args': [_serviceNames], | ||
'context': this, | ||
'interval': 500, | ||
'max_interval': timeout, | ||
'max_tries': Number.MAX_SAFE_INTEGER, | ||
'timeout': timeout | ||
}).then(() => true); | ||
} | ||
@@ -352,0 +359,0 @@ } |
{ | ||
"name": "@opuscapita/config", | ||
"version": "3.1.13", | ||
"version": "3.1.14", | ||
"description": "Configuration API connector module for OpusCapita Business Network Portal.", | ||
@@ -9,5 +9,3 @@ "main": "index.js", | ||
"test": "npm run setup-consul ; npx nyc --all -r lcov mocha --exit --timeout 30000 -R mocha-junit-reporter --reporter-options mochaFile=junit/integration-test-results.xml,outputs=true", | ||
"setup-consul": "sh ./setup-consul.sh", | ||
"api-doc": "npx jsdoc2md --files ./lib/* > wiki/Home.md", | ||
"doc": "npm run api-doc" | ||
"setup-consul": "sh ./setup-consul.sh" | ||
}, | ||
@@ -38,10 +36,9 @@ "repository": { | ||
"@opuscapita/eslint-config-opuscapita-bnapp": "^1.3.5", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^18.11.15", | ||
"eslint": "^8.29.0", | ||
"jsdoc-to-markdown": "^8.0.0", | ||
"@types/mocha": "^10.0.3", | ||
"@types/node": "^18.18.8", | ||
"eslint": "^8.52.0", | ||
"mocha": "^10.2.0", | ||
"mocha-junit-reporter": "^2.2.0", | ||
"mocha-junit-reporter": "^2.2.1", | ||
"nyc": "^15.1.0" | ||
} | ||
} |
38074
7
662