andoncloud-prometheus-widget 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1713,7 +1713,7 @@ var Translator = function (_EventEmitter) {
1713
1713
  } else {
1714
1714
  var pluralSuffix;
1715
1715
  if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
1716
- var zeroSuffix = '_zero';
1716
+ var zeroSuffix = "".concat(_this4.options.pluralSeparator, "zero");
1717
1717
 
1718
1718
  if (needsPluralHandling) {
1719
1719
  finalKeys.push(key + pluralSuffix);
@@ -2649,6 +2649,8 @@ var Connector = function (_EventEmitter) {
2649
2649
  _this.waitingReads = [];
2650
2650
  _this.maxParallelReads = options.maxParallelReads || 10;
2651
2651
  _this.readingCalls = 0;
2652
+ _this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
2653
+ _this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
2652
2654
  _this.state = {};
2653
2655
  _this.queue = [];
2654
2656
 
@@ -2755,7 +2757,7 @@ var Connector = function (_EventEmitter) {
2755
2757
  var _this3 = this;
2756
2758
 
2757
2759
  var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2758
- var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 350;
2760
+ var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
2759
2761
  var callback = arguments.length > 5 ? arguments[5] : undefined;
2760
2762
  if (!lng.length) return callback(null, {});
2761
2763
 
@@ -2773,13 +2775,6 @@ var Connector = function (_EventEmitter) {
2773
2775
 
2774
2776
  this.readingCalls++;
2775
2777
  return this.backend[fcName](lng, ns, function (err, data) {
2776
- if (err && data && tried < 5) {
2777
- setTimeout(function () {
2778
- _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
2779
- }, wait);
2780
- return;
2781
- }
2782
-
2783
2778
  _this3.readingCalls--;
2784
2779
 
2785
2780
  if (_this3.waitingReads.length > 0) {
@@ -2788,6 +2783,13 @@ var Connector = function (_EventEmitter) {
2788
2783
  _this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
2789
2784
  }
2790
2785
 
2786
+ if (err && data && tried < _this3.maxRetries) {
2787
+ setTimeout(function () {
2788
+ _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
2789
+ }, wait);
2790
+ return;
2791
+ }
2792
+
2791
2793
  callback(err, data);
2792
2794
  });
2793
2795
  }
@@ -3023,7 +3025,7 @@ var I18n = function (_EventEmitter) {
3023
3025
  options = {};
3024
3026
  }
3025
3027
 
3026
- if (!options.defaultNS && options.ns) {
3028
+ if (!options.defaultNS && options.defaultNS !== false && options.ns) {
3027
3029
  if (typeof options.ns === 'string') {
3028
3030
  options.defaultNS = options.ns;
3029
3031
  } else if (options.ns.indexOf('translation') < 0) {
@@ -3379,8 +3381,9 @@ var I18n = function (_EventEmitter) {
3379
3381
  options.lng = options.lng || fixedT.lng;
3380
3382
  options.lngs = options.lngs || fixedT.lngs;
3381
3383
  options.ns = options.ns || fixedT.ns;
3384
+ options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
3382
3385
  var keySeparator = _this5.options.keySeparator || '.';
3383
- var resultKey = keyPrefix ? "".concat(keyPrefix).concat(keySeparator).concat(key) : key;
3386
+ var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
3384
3387
  return _this5.t(resultKey, options);
3385
3388
  };
3386
3389
 
@@ -3644,7 +3647,7 @@ function _extends() {
3644
3647
  return _extends.apply(this, arguments);
3645
3648
  }
3646
3649
 
3647
- var LIBRARY_VERSION = '1.2.0';
3650
+ var LIBRARY_VERSION = '1.2.1';
3648
3651
 
3649
3652
  var QueriesPeriod;
3650
3653