@splitsoftware/splitio-commons 1.16.1-rc.7 → 1.16.1-rc.8
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/cjs/sync/streaming/pushManager.js +2 -0
- package/esm/sync/streaming/pushManager.js +2 -0
- package/package.json +1 -1
- package/src/services/splitApi.ts +1 -1
- package/src/services/splitHttpClient.ts +1 -1
- package/src/sync/streaming/SSEHandler/types.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +1 -1
- package/src/sync/streaming/pushManager.ts +2 -0
- package/types/services/splitApi.d.ts +1 -1
- package/types/services/splitHttpClient.d.ts +1 -1
|
@@ -20,6 +20,8 @@ var murmur3_1 = require("../../utils/murmur3/murmur3");
|
|
|
20
20
|
var murmur3_64_1 = require("../../utils/murmur3/murmur3_64");
|
|
21
21
|
var constants_3 = require("../../utils/constants");
|
|
22
22
|
function getDelay(parsedData, matchingKey) {
|
|
23
|
+
if (parsedData.h === 0)
|
|
24
|
+
return 0;
|
|
23
25
|
var interval = parsedData.i || 60000;
|
|
24
26
|
var seed = parsedData.s || 0;
|
|
25
27
|
return (0, murmur3_1.hash)(matchingKey, seed) % interval;
|
|
@@ -17,6 +17,8 @@ import { hash } from '../../utils/murmur3/murmur3';
|
|
|
17
17
|
import { hash64 } from '../../utils/murmur3/murmur3_64';
|
|
18
18
|
import { TOKEN_REFRESH, AUTH_REJECTION, MY_LARGE_SEGMENT, MY_SEGMENT } from '../../utils/constants';
|
|
19
19
|
export function getDelay(parsedData, matchingKey) {
|
|
20
|
+
if (parsedData.h === 0)
|
|
21
|
+
return 0;
|
|
20
22
|
var interval = parsedData.i || 60000;
|
|
21
23
|
var seed = parsedData.s || 0;
|
|
22
24
|
return hash(matchingKey, seed) % interval;
|
package/package.json
CHANGED
package/src/services/splitApi.ts
CHANGED
|
@@ -12,7 +12,7 @@ const messageNoFetch = 'Global fetch API is not available.';
|
|
|
12
12
|
* @param settings SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
13
13
|
* @param platform object containing environment-specific dependencies
|
|
14
14
|
*/
|
|
15
|
-
export function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: IPlatform): ISplitHttpClient {
|
|
15
|
+
export function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: Pick<IPlatform, 'getOptions' | 'getFetch'>): ISplitHttpClient {
|
|
16
16
|
|
|
17
17
|
const { log, core: { authorizationKey }, version, runtime: { ip, hostname } } = settings;
|
|
18
18
|
const options = getOptions && getOptions(settings);
|
|
@@ -43,7 +43,7 @@ export interface IMyLargeSegmentsUpdateData {
|
|
|
43
43
|
d: string,
|
|
44
44
|
u: UpdateStrategy,
|
|
45
45
|
i?: number, // time interval in millis
|
|
46
|
-
h?: number, // hash function
|
|
46
|
+
h?: number, // hash function
|
|
47
47
|
s?: number, // seed for hash function
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -36,7 +36,7 @@ export function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask,
|
|
|
36
36
|
|
|
37
37
|
syncTask.then((result) => {
|
|
38
38
|
if (!isHandlingEvent) return; // halt if `stop` has been called
|
|
39
|
-
if (result !== false) {// Unlike `Splits|SegmentsUpdateWorker`, we cannot use `mySegmentsCache.getChangeNumber` since `/mySegments` endpoint doesn't provide this value.
|
|
39
|
+
if (result !== false) { // Unlike `Splits|SegmentsUpdateWorker`, we cannot use `mySegmentsCache.getChangeNumber` since `/mySegments` endpoint doesn't provide this value.
|
|
40
40
|
if (_segmentsData) telemetryTracker.trackUpdatesFromSSE(updateType);
|
|
41
41
|
currentChangeNumber = Math.max(currentChangeNumber, currentMaxChangeNumber); // use `currentMaxChangeNumber`, in case that `maxChangeNumber` was updated during fetch.
|
|
42
42
|
}
|
|
@@ -23,6 +23,8 @@ import { TOKEN_REFRESH, AUTH_REJECTION, MY_LARGE_SEGMENT, MY_SEGMENT } from '../
|
|
|
23
23
|
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
24
24
|
|
|
25
25
|
export function getDelay(parsedData: Pick<IMyLargeSegmentsUpdateData, 'i' | 'h' | 's'>, matchingKey: string) {
|
|
26
|
+
if (parsedData.h === 0) return 0;
|
|
27
|
+
|
|
26
28
|
const interval = parsedData.i || 60000;
|
|
27
29
|
const seed = parsedData.s || 0;
|
|
28
30
|
|
|
@@ -9,4 +9,4 @@ import { ITelemetryTracker } from '../trackers/types';
|
|
|
9
9
|
* @param platform object containing environment-specific dependencies
|
|
10
10
|
* @param telemetryTracker telemetry tracker
|
|
11
11
|
*/
|
|
12
|
-
export declare function splitApiFactory(settings: ISettings, platform: IPlatform, telemetryTracker: ITelemetryTracker): ISplitApi;
|
|
12
|
+
export declare function splitApiFactory(settings: ISettings, platform: Pick<IPlatform, 'getOptions' | 'getFetch'>, telemetryTracker: ITelemetryTracker): ISplitApi;
|
|
@@ -7,4 +7,4 @@ import { IPlatform } from '../sdkFactory/types';
|
|
|
7
7
|
* @param settings SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
8
8
|
* @param platform object containing environment-specific dependencies
|
|
9
9
|
*/
|
|
10
|
-
export declare function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: IPlatform): ISplitHttpClient;
|
|
10
|
+
export declare function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: Pick<IPlatform, 'getOptions' | 'getFetch'>): ISplitHttpClient;
|