featureflow-node-sdk 0.6.18 → 0.6.19

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.
@@ -14,6 +14,10 @@ var _debug = require('./debug');
14
14
 
15
15
  var _debug2 = _interopRequireDefault(_debug);
16
16
 
17
+ var _package = require('../package.json');
18
+
19
+ var _package2 = _interopRequireDefault(_package);
20
+
17
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
22
 
19
23
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -29,7 +33,7 @@ var EventsClient = function () {
29
33
 
30
34
  this.SEND_INTERVAL = 60;
31
35
  this.QUEUE_SIZE = 10000;
32
- this.clientVersion = 'NodeJsClient/0.6.18';
36
+ this.clientVersion = 'NodeJsClient/' + _package2.default.version;
33
37
  this.queue = [];
34
38
  this.overLimit = false;
35
39
 
@@ -14,6 +14,10 @@ var _debug = require('./debug');
14
14
 
15
15
  var _debug2 = _interopRequireDefault(_debug);
16
16
 
17
+ var _package = require('../package.json');
18
+
19
+ var _package2 = _interopRequireDefault(_package);
20
+
17
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
22
 
19
23
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -24,7 +28,7 @@ var PollingClient = function () {
24
28
 
25
29
  this.DEFAULT_TIMEOUT = 5 * 1000;
26
30
  this.DEFAULT_INTERVAL = 20 * 1000;
27
- this.clientVersion = 'NodeJsClient/0.6.18';
31
+ this.clientVersion = 'NodeJsClient/' + _package2.default.version;
28
32
  this.lastRefreshTime = 0;
29
33
  this.refreshInProgress = false;
30
34
 
@@ -56,6 +60,7 @@ var PollingClient = function () {
56
60
 
57
61
  var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
58
62
 
63
+ this.refreshInProgress = true;
59
64
  this.lastRefreshTime = Date.now();
60
65
  (0, _request2.default)({
61
66
  method: 'get',
@@ -67,6 +72,7 @@ var PollingClient = function () {
67
72
  'X-Featureflow-Client': this.clientVersion
68
73
  }
69
74
  }, function (error, response, body) {
75
+ _this.refreshInProgress = false;
70
76
  if (response) {
71
77
  if (response.statusCode === 200) {
72
78
  _this.etag = response.headers['etag'];
@@ -86,18 +92,11 @@ var PollingClient = function () {
86
92
  }, {
87
93
  key: 'maybeRefresh',
88
94
  value: function maybeRefresh() {
89
- var _this2 = this;
90
-
91
95
  var now = Date.now();
92
96
  var elapsed = now - this.lastRefreshTime;
93
97
 
94
98
  if (elapsed >= this.pollingInterval && !this.refreshInProgress) {
95
- this.refreshInProgress = true;
96
- this.lastRefreshTime = now;
97
-
98
- this.getFeatures(function () {
99
- _this2.refreshInProgress = false;
100
- });
99
+ this.getFeatures();
101
100
  }
102
101
  }
103
102
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "featureflow-node-sdk",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "description": "Featureflow sdk for Node",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",