@splitsoftware/splitio-commons 1.6.2-rc.11 → 1.6.2-rc.12

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.
@@ -75,13 +75,15 @@ function PluggableStorage(options) {
75
75
  // Connects to wrapper and emits SDK_READY event on main client
76
76
  var connectPromise = wrapper.connect().then(function () {
77
77
  onReadyCb();
78
- // Start periodic flush of async storages
79
- if (impressionCountsCache && impressionCountsCache.start)
80
- impressionCountsCache.start();
81
- if (uniqueKeysCache && uniqueKeysCache.start)
82
- uniqueKeysCache.start();
83
- if (telemetry && telemetry.recordConfig && !isSyncronizer)
84
- telemetry.recordConfig();
78
+ // Start periodic flush of async storages if not running synchronizer (producer mode)
79
+ if (!isSyncronizer) {
80
+ if (impressionCountsCache && impressionCountsCache.start)
81
+ impressionCountsCache.start();
82
+ if (uniqueKeysCache && uniqueKeysCache.start)
83
+ uniqueKeysCache.start();
84
+ if (telemetry && telemetry.recordConfig)
85
+ telemetry.recordConfig();
86
+ }
85
87
  }).catch(function (e) {
86
88
  e = e || new Error('Error connecting wrapper');
87
89
  onReadyCb(e);
@@ -95,9 +97,9 @@ function PluggableStorage(options) {
95
97
  events: isPartialConsumer ? promisifyEventsTrack(new EventsCacheInMemory_1.EventsCacheInMemory(eventsQueueSize)) : new EventsCachePluggable_1.EventsCachePluggable(log, keys.buildEventsKey(), wrapper, metadata),
96
98
  telemetry: telemetry,
97
99
  uniqueKeys: uniqueKeysCache,
98
- // Disconnect the underlying storage
100
+ // Stop periodic flush and disconnect the underlying storage
99
101
  destroy: function () {
100
- return Promise.all([
102
+ return Promise.all(isSyncronizer ? [] : [
101
103
  impressionCountsCache && impressionCountsCache.stop && impressionCountsCache.stop(),
102
104
  uniqueKeysCache && uniqueKeysCache.stop && uniqueKeysCache.stop(),
103
105
  ]).then(function () { return wrapper.disconnect(); });
@@ -72,13 +72,15 @@ export function PluggableStorage(options) {
72
72
  // Connects to wrapper and emits SDK_READY event on main client
73
73
  var connectPromise = wrapper.connect().then(function () {
74
74
  onReadyCb();
75
- // Start periodic flush of async storages
76
- if (impressionCountsCache && impressionCountsCache.start)
77
- impressionCountsCache.start();
78
- if (uniqueKeysCache && uniqueKeysCache.start)
79
- uniqueKeysCache.start();
80
- if (telemetry && telemetry.recordConfig && !isSyncronizer)
81
- telemetry.recordConfig();
75
+ // Start periodic flush of async storages if not running synchronizer (producer mode)
76
+ if (!isSyncronizer) {
77
+ if (impressionCountsCache && impressionCountsCache.start)
78
+ impressionCountsCache.start();
79
+ if (uniqueKeysCache && uniqueKeysCache.start)
80
+ uniqueKeysCache.start();
81
+ if (telemetry && telemetry.recordConfig)
82
+ telemetry.recordConfig();
83
+ }
82
84
  }).catch(function (e) {
83
85
  e = e || new Error('Error connecting wrapper');
84
86
  onReadyCb(e);
@@ -92,9 +94,9 @@ export function PluggableStorage(options) {
92
94
  events: isPartialConsumer ? promisifyEventsTrack(new EventsCacheInMemory(eventsQueueSize)) : new EventsCachePluggable(log, keys.buildEventsKey(), wrapper, metadata),
93
95
  telemetry: telemetry,
94
96
  uniqueKeys: uniqueKeysCache,
95
- // Disconnect the underlying storage
97
+ // Stop periodic flush and disconnect the underlying storage
96
98
  destroy: function () {
97
- return Promise.all([
99
+ return Promise.all(isSyncronizer ? [] : [
98
100
  impressionCountsCache && impressionCountsCache.stop && impressionCountsCache.stop(),
99
101
  uniqueKeysCache && uniqueKeysCache.stop && uniqueKeysCache.stop(),
100
102
  ]).then(function () { return wrapper.disconnect(); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "1.6.2-rc.11",
3
+ "version": "1.6.2-rc.12",
4
4
  "description": "Split Javascript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -90,10 +90,12 @@ export function PluggableStorage(options: PluggableStorageOptions): IStorageAsyn
90
90
  const connectPromise = wrapper.connect().then(() => {
91
91
  onReadyCb();
92
92
 
93
- // Start periodic flush of async storages
94
- if (impressionCountsCache && (impressionCountsCache as ImpressionCountsCachePluggable).start) (impressionCountsCache as ImpressionCountsCachePluggable).start();
95
- if (uniqueKeysCache && (uniqueKeysCache as UniqueKeysCachePluggable).start) (uniqueKeysCache as UniqueKeysCachePluggable).start();
96
- if (telemetry && (telemetry as ITelemetryCacheAsync).recordConfig && !isSyncronizer) (telemetry as ITelemetryCacheAsync).recordConfig();
93
+ // Start periodic flush of async storages if not running synchronizer (producer mode)
94
+ if (!isSyncronizer) {
95
+ if (impressionCountsCache && (impressionCountsCache as ImpressionCountsCachePluggable).start) (impressionCountsCache as ImpressionCountsCachePluggable).start();
96
+ if (uniqueKeysCache && (uniqueKeysCache as UniqueKeysCachePluggable).start) (uniqueKeysCache as UniqueKeysCachePluggable).start();
97
+ if (telemetry && (telemetry as ITelemetryCacheAsync).recordConfig) (telemetry as ITelemetryCacheAsync).recordConfig();
98
+ }
97
99
  }).catch((e) => {
98
100
  e = e || new Error('Error connecting wrapper');
99
101
  onReadyCb(e);
@@ -109,9 +111,9 @@ export function PluggableStorage(options: PluggableStorageOptions): IStorageAsyn
109
111
  telemetry,
110
112
  uniqueKeys: uniqueKeysCache,
111
113
 
112
- // Disconnect the underlying storage
114
+ // Stop periodic flush and disconnect the underlying storage
113
115
  destroy() {
114
- return Promise.all([
116
+ return Promise.all(isSyncronizer ? [] : [
115
117
  impressionCountsCache && (impressionCountsCache as ImpressionCountsCachePluggable).stop && (impressionCountsCache as ImpressionCountsCachePluggable).stop(),
116
118
  uniqueKeysCache && (uniqueKeysCache as UniqueKeysCachePluggable).stop && (uniqueKeysCache as UniqueKeysCachePluggable).stop(),
117
119
  ]).then(() => wrapper.disconnect());