@splitsoftware/splitio-commons 1.16.1-rc.3 → 1.16.1-rc.5
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.
|
@@ -23,6 +23,7 @@ function MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker, updateType
|
|
|
23
23
|
var syncTask = _delay ?
|
|
24
24
|
new Promise(function (res) {
|
|
25
25
|
_delayTimeoutID = setTimeout(function () {
|
|
26
|
+
_delay = undefined;
|
|
26
27
|
mySegmentsSyncTask.execute(_segmentsData, true).then(res);
|
|
27
28
|
}, _delay);
|
|
28
29
|
}) :
|
|
@@ -49,13 +50,15 @@ function MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker, updateType
|
|
|
49
50
|
}
|
|
50
51
|
return {
|
|
51
52
|
/**
|
|
52
|
-
* Invoked by NotificationProcessor on
|
|
53
|
+
* Invoked by NotificationProcessor on MY_(LARGE)_SEGMENTS_UPDATE notifications
|
|
53
54
|
*
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
55
|
+
* @param changeNumber change number of the notification
|
|
56
|
+
* @param segmentsData data for KeyList or SegmentRemoval instant updates
|
|
57
|
+
* @param delay optional time to wait for BoundedFetchRequest or BoundedFetchRequest updates
|
|
56
58
|
*/
|
|
57
59
|
put: function (changeNumber, segmentsData, delay) {
|
|
58
|
-
if
|
|
60
|
+
// Ignore event if it is outdated or if there is a pending fetch request (_delay is set)
|
|
61
|
+
if (changeNumber <= currentChangeNumber || changeNumber <= maxChangeNumber || _delay)
|
|
59
62
|
return;
|
|
60
63
|
maxChangeNumber = changeNumber;
|
|
61
64
|
handleNewEvent = true;
|
|
@@ -67,6 +70,7 @@ function MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker, updateType
|
|
|
67
70
|
},
|
|
68
71
|
stop: function () {
|
|
69
72
|
clearTimeout(_delayTimeoutID);
|
|
73
|
+
_delay = undefined;
|
|
70
74
|
isHandlingEvent = false;
|
|
71
75
|
backoff.reset();
|
|
72
76
|
}
|
|
@@ -20,6 +20,7 @@ export function MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker, upd
|
|
|
20
20
|
var syncTask = _delay ?
|
|
21
21
|
new Promise(function (res) {
|
|
22
22
|
_delayTimeoutID = setTimeout(function () {
|
|
23
|
+
_delay = undefined;
|
|
23
24
|
mySegmentsSyncTask.execute(_segmentsData, true).then(res);
|
|
24
25
|
}, _delay);
|
|
25
26
|
}) :
|
|
@@ -46,13 +47,15 @@ export function MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker, upd
|
|
|
46
47
|
}
|
|
47
48
|
return {
|
|
48
49
|
/**
|
|
49
|
-
* Invoked by NotificationProcessor on
|
|
50
|
+
* Invoked by NotificationProcessor on MY_(LARGE)_SEGMENTS_UPDATE notifications
|
|
50
51
|
*
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
52
|
+
* @param changeNumber change number of the notification
|
|
53
|
+
* @param segmentsData data for KeyList or SegmentRemoval instant updates
|
|
54
|
+
* @param delay optional time to wait for BoundedFetchRequest or BoundedFetchRequest updates
|
|
53
55
|
*/
|
|
54
56
|
put: function (changeNumber, segmentsData, delay) {
|
|
55
|
-
if
|
|
57
|
+
// Ignore event if it is outdated or if there is a pending fetch request (_delay is set)
|
|
58
|
+
if (changeNumber <= currentChangeNumber || changeNumber <= maxChangeNumber || _delay)
|
|
56
59
|
return;
|
|
57
60
|
maxChangeNumber = changeNumber;
|
|
58
61
|
handleNewEvent = true;
|
|
@@ -64,6 +67,7 @@ export function MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker, upd
|
|
|
64
67
|
},
|
|
65
68
|
stop: function () {
|
|
66
69
|
clearTimeout(_delayTimeoutID);
|
|
70
|
+
_delay = undefined;
|
|
67
71
|
isHandlingEvent = false;
|
|
68
72
|
backoff.reset();
|
|
69
73
|
}
|
package/package.json
CHANGED
|
@@ -76,12 +76,10 @@ export class SSEClient implements ISSEClient {
|
|
|
76
76
|
open(authToken: IAuthTokenPushEnabled) {
|
|
77
77
|
this.close(); // it closes connection if previously opened
|
|
78
78
|
|
|
79
|
-
const channelsQueryParam = Object.keys(authToken.channels).map(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
).join(',');
|
|
79
|
+
const channelsQueryParam = Object.keys(authToken.channels).map((channel) => {
|
|
80
|
+
const params = CONTROL_CHANNEL_REGEX.test(channel) ? '[?occupancy=metrics.publishers]' : '';
|
|
81
|
+
return encodeURIComponent(params + channel);
|
|
82
|
+
}).join(',');
|
|
85
83
|
const url = `${this.streamingUrl}?channels=${channelsQueryParam}&accessToken=${authToken.token}&v=${ABLY_API_VERSION}&heartbeats=true`; // same results using `&heartbeats=false`
|
|
86
84
|
|
|
87
85
|
this.connection = new this.eventSource!(
|
|
@@ -28,6 +28,7 @@ export function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask,
|
|
|
28
28
|
const syncTask = _delay ?
|
|
29
29
|
new Promise(res => {
|
|
30
30
|
_delayTimeoutID = setTimeout(() => {
|
|
31
|
+
_delay = undefined;
|
|
31
32
|
mySegmentsSyncTask.execute(_segmentsData, true).then(res);
|
|
32
33
|
}, _delay);
|
|
33
34
|
}) :
|
|
@@ -52,13 +53,15 @@ export function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask,
|
|
|
52
53
|
|
|
53
54
|
return {
|
|
54
55
|
/**
|
|
55
|
-
* Invoked by NotificationProcessor on
|
|
56
|
+
* Invoked by NotificationProcessor on MY_(LARGE)_SEGMENTS_UPDATE notifications
|
|
56
57
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
58
|
+
* @param changeNumber change number of the notification
|
|
59
|
+
* @param segmentsData data for KeyList or SegmentRemoval instant updates
|
|
60
|
+
* @param delay optional time to wait for BoundedFetchRequest or BoundedFetchRequest updates
|
|
59
61
|
*/
|
|
60
62
|
put(changeNumber: number, segmentsData?: MySegmentsData, delay?: number) {
|
|
61
|
-
if
|
|
63
|
+
// Ignore event if it is outdated or if there is a pending fetch request (_delay is set)
|
|
64
|
+
if (changeNumber <= currentChangeNumber || changeNumber <= maxChangeNumber || _delay) return;
|
|
62
65
|
|
|
63
66
|
maxChangeNumber = changeNumber;
|
|
64
67
|
handleNewEvent = true;
|
|
@@ -71,6 +74,7 @@ export function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask,
|
|
|
71
74
|
|
|
72
75
|
stop() {
|
|
73
76
|
clearTimeout(_delayTimeoutID);
|
|
77
|
+
_delay = undefined;
|
|
74
78
|
isHandlingEvent = false;
|
|
75
79
|
backoff.reset();
|
|
76
80
|
}
|