@autofleet/settings 1.3.1 → 1.3.3

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
@@ -118,7 +118,7 @@ class SettingsManager {
118
118
  settingsToGet.map((obj) => {
119
119
  const cacheKey = this.getCacheKey(obj.key, labels);
120
120
  const cacheValue = this.settingsCache.get(cacheKey);
121
- if (cacheValue) {
121
+ if (cacheValue && cacheValue !== waitingToNetwork) {
122
122
  settingsToReturn.set(obj.key, cacheValue);
123
123
  }
124
124
  else {
@@ -161,7 +161,9 @@ class SettingsManager {
161
161
  this.settingsCache.del(cacheKey);
162
162
  throw err;
163
163
  }
164
- this.settingsCache.set(cacheKey, returnValue, this.ttl);
164
+ if (settingsToFetch.indexOf(setting.key) !== -1) {
165
+ this.settingsCache.set(cacheKey, returnValue, this.ttl);
166
+ }
165
167
  return returnValue;
166
168
  });
167
169
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/settings",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -169,7 +169,7 @@ class SettingsManager {
169
169
  settingsToGet.map((obj) => {
170
170
  const cacheKey = this.getCacheKey(obj.key, labels);
171
171
  const cacheValue = this.settingsCache.get(cacheKey);
172
- if (cacheValue) {
172
+ if (cacheValue && cacheValue !== waitingToNetwork) {
173
173
  settingsToReturn.set(obj.key, cacheValue);
174
174
  } else {
175
175
  settingsToFetch.push(obj.key);
@@ -213,7 +213,9 @@ class SettingsManager {
213
213
  this.settingsCache.del(cacheKey);
214
214
  throw err;
215
215
  }
216
- this.settingsCache.set(cacheKey, returnValue, this.ttl);
216
+ if (settingsToFetch.indexOf(setting.key) !== -1) {
217
+ this.settingsCache.set(cacheKey, returnValue, this.ttl);
218
+ }
217
219
  return returnValue;
218
220
  });
219
221
  }