@splitsoftware/splitio-commons 2.2.1-rc.1 → 2.2.1-rc.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.
Files changed (143) hide show
  1. package/CHANGES.txt +2 -2
  2. package/README.md +0 -1
  3. package/cjs/evaluator/combiners/and.js +6 -2
  4. package/cjs/evaluator/combiners/ifelseif.js +6 -6
  5. package/cjs/evaluator/condition/index.js +5 -6
  6. package/cjs/evaluator/index.js +7 -7
  7. package/cjs/evaluator/matchers/index.js +1 -3
  8. package/cjs/evaluator/matchers/matcherTypes.js +0 -1
  9. package/cjs/evaluator/matchersTransform/index.js +0 -4
  10. package/cjs/evaluator/parser/index.js +2 -2
  11. package/cjs/evaluator/value/sanitize.js +0 -1
  12. package/cjs/logger/constants.js +3 -4
  13. package/cjs/logger/messages/debug.js +2 -3
  14. package/cjs/logger/messages/warn.js +1 -1
  15. package/cjs/sdkFactory/index.js +3 -0
  16. package/cjs/services/splitApi.js +4 -3
  17. package/cjs/storages/AbstractSplitsCacheSync.js +2 -5
  18. package/cjs/storages/KeyBuilder.js +0 -9
  19. package/cjs/storages/KeyBuilderCS.js +0 -3
  20. package/cjs/storages/KeyBuilderSS.js +0 -3
  21. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +14 -9
  22. package/cjs/storages/inLocalStorage/index.js +1 -5
  23. package/cjs/storages/inLocalStorage/validateCache.js +1 -2
  24. package/cjs/storages/inMemory/InMemoryStorage.js +0 -3
  25. package/cjs/storages/inMemory/InMemoryStorageCS.js +0 -4
  26. package/cjs/storages/inRedis/index.js +12 -6
  27. package/cjs/storages/pluggable/index.js +0 -2
  28. package/cjs/sync/polling/fetchers/splitChangesFetcher.js +4 -51
  29. package/cjs/sync/polling/pollingManagerCS.js +7 -7
  30. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  31. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  32. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  33. package/cjs/sync/polling/updaters/splitChangesUpdater.js +33 -51
  34. package/cjs/sync/streaming/SSEHandler/index.js +0 -1
  35. package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +77 -106
  36. package/cjs/sync/streaming/constants.js +1 -2
  37. package/cjs/sync/streaming/pushManager.js +16 -3
  38. package/cjs/sync/syncManagerOnline.js +2 -2
  39. package/cjs/utils/constants/index.js +2 -3
  40. package/esm/evaluator/combiners/and.js +6 -2
  41. package/esm/evaluator/combiners/ifelseif.js +7 -7
  42. package/esm/evaluator/condition/index.js +5 -6
  43. package/esm/evaluator/index.js +7 -7
  44. package/esm/evaluator/matchers/index.js +1 -3
  45. package/esm/evaluator/matchers/matcherTypes.js +0 -1
  46. package/esm/evaluator/matchersTransform/index.js +0 -4
  47. package/esm/evaluator/parser/index.js +2 -2
  48. package/esm/evaluator/value/sanitize.js +0 -1
  49. package/esm/logger/constants.js +0 -1
  50. package/esm/logger/messages/debug.js +2 -3
  51. package/esm/logger/messages/warn.js +1 -1
  52. package/esm/sdkFactory/index.js +4 -1
  53. package/esm/services/splitApi.js +4 -3
  54. package/esm/storages/AbstractSplitsCacheSync.js +2 -5
  55. package/esm/storages/KeyBuilder.js +0 -9
  56. package/esm/storages/KeyBuilderCS.js +0 -3
  57. package/esm/storages/KeyBuilderSS.js +0 -3
  58. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +14 -9
  59. package/esm/storages/inLocalStorage/index.js +1 -5
  60. package/esm/storages/inLocalStorage/validateCache.js +1 -2
  61. package/esm/storages/inMemory/InMemoryStorage.js +0 -3
  62. package/esm/storages/inMemory/InMemoryStorageCS.js +0 -4
  63. package/esm/storages/inRedis/index.js +12 -6
  64. package/esm/storages/pluggable/index.js +0 -2
  65. package/esm/sync/polling/fetchers/splitChangesFetcher.js +4 -51
  66. package/esm/sync/polling/pollingManagerCS.js +7 -7
  67. package/esm/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  68. package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
  69. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  70. package/esm/sync/polling/updaters/splitChangesUpdater.js +33 -51
  71. package/esm/sync/streaming/SSEHandler/index.js +1 -2
  72. package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +73 -102
  73. package/esm/sync/streaming/constants.js +0 -1
  74. package/esm/sync/streaming/pushManager.js +19 -6
  75. package/esm/sync/syncManagerOnline.js +2 -2
  76. package/esm/utils/constants/index.js +1 -2
  77. package/package.json +1 -1
  78. package/src/dtos/types.ts +8 -32
  79. package/src/evaluator/Engine.ts +1 -1
  80. package/src/evaluator/combiners/and.ts +4 -5
  81. package/src/evaluator/combiners/ifelseif.ts +9 -7
  82. package/src/evaluator/condition/engineUtils.ts +1 -1
  83. package/src/evaluator/condition/index.ts +12 -12
  84. package/src/evaluator/index.ts +7 -7
  85. package/src/evaluator/matchers/index.ts +1 -3
  86. package/src/evaluator/matchers/matcherTypes.ts +0 -1
  87. package/src/evaluator/matchersTransform/index.ts +0 -3
  88. package/src/evaluator/parser/index.ts +3 -3
  89. package/src/evaluator/types.ts +2 -2
  90. package/src/evaluator/value/index.ts +2 -2
  91. package/src/evaluator/value/sanitize.ts +4 -5
  92. package/src/logger/constants.ts +0 -1
  93. package/src/logger/messages/debug.ts +2 -3
  94. package/src/logger/messages/warn.ts +1 -1
  95. package/src/sdkFactory/index.ts +4 -1
  96. package/src/sdkManager/index.ts +1 -1
  97. package/src/services/splitApi.ts +4 -3
  98. package/src/services/types.ts +1 -1
  99. package/src/storages/AbstractSplitsCacheSync.ts +3 -6
  100. package/src/storages/KeyBuilder.ts +0 -12
  101. package/src/storages/KeyBuilderCS.ts +0 -4
  102. package/src/storages/KeyBuilderSS.ts +0 -4
  103. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +14 -10
  104. package/src/storages/inLocalStorage/index.ts +1 -5
  105. package/src/storages/inLocalStorage/validateCache.ts +1 -3
  106. package/src/storages/inMemory/InMemoryStorage.ts +0 -3
  107. package/src/storages/inMemory/InMemoryStorageCS.ts +0 -4
  108. package/src/storages/inRedis/index.ts +15 -8
  109. package/src/storages/pluggable/index.ts +0 -2
  110. package/src/storages/types.ts +2 -33
  111. package/src/sync/polling/fetchers/splitChangesFetcher.ts +4 -62
  112. package/src/sync/polling/fetchers/types.ts +0 -1
  113. package/src/sync/polling/pollingManagerCS.ts +7 -7
  114. package/src/sync/polling/syncTasks/splitsSyncTask.ts +1 -1
  115. package/src/sync/polling/types.ts +2 -2
  116. package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -2
  117. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  118. package/src/sync/polling/updaters/splitChangesUpdater.ts +42 -61
  119. package/src/sync/streaming/SSEHandler/index.ts +1 -2
  120. package/src/sync/streaming/SSEHandler/types.ts +2 -2
  121. package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +68 -98
  122. package/src/sync/streaming/constants.ts +0 -1
  123. package/src/sync/streaming/parseUtils.ts +2 -2
  124. package/src/sync/streaming/pushManager.ts +18 -6
  125. package/src/sync/streaming/types.ts +2 -3
  126. package/src/sync/syncManagerOnline.ts +2 -2
  127. package/src/utils/constants/index.ts +1 -2
  128. package/src/utils/lang/index.ts +1 -1
  129. package/cjs/evaluator/matchers/rbsegment.js +0 -44
  130. package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -117
  131. package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +0 -61
  132. package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +0 -64
  133. package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +0 -64
  134. package/esm/evaluator/matchers/rbsegment.js +0 -40
  135. package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -114
  136. package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +0 -58
  137. package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +0 -61
  138. package/esm/storages/pluggable/RBSegmentsCachePluggable.js +0 -61
  139. package/src/evaluator/matchers/rbsegment.ts +0 -62
  140. package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +0 -136
  141. package/src/storages/inMemory/RBSegmentsCacheInMemory.ts +0 -68
  142. package/src/storages/inRedis/RBSegmentsCacheInRedis.ts +0 -79
  143. package/src/storages/pluggable/RBSegmentsCachePluggable.ts +0 -76
@@ -1,4 +1,4 @@
1
- import { findIndex, isBoolean } from '../../utils/lang';
1
+ import { findIndex } from '../../utils/lang';
2
2
  import { thenable } from '../../utils/promise/thenable';
3
3
  import { UNSUPPORTED_MATCHER_TYPE } from '../../utils/labels';
4
4
  import { CONTROL } from '../../utils/constants';
@@ -11,12 +11,12 @@ export function ifElseIfCombinerContext(log, predicates) {
11
11
  label: UNSUPPORTED_MATCHER_TYPE
12
12
  };
13
13
  }
14
- function computeEvaluation(predicateResults) {
15
- for (var i = 0, len = predicateResults.length; i < len; i++) {
14
+ function computeTreatment(predicateResults) {
15
+ var len = predicateResults.length;
16
+ for (var i = 0; i < len; i++) {
16
17
  var evaluation = predicateResults[i];
17
18
  if (evaluation !== undefined) {
18
- if (!isBoolean(evaluation))
19
- log.debug(ENGINE_COMBINER_IFELSEIF, [evaluation.treatment]);
19
+ log.debug(ENGINE_COMBINER_IFELSEIF, [evaluation.treatment]);
20
20
  return evaluation;
21
21
  }
22
22
  }
@@ -30,9 +30,9 @@ export function ifElseIfCombinerContext(log, predicates) {
30
30
  var predicateResults = predicates.map(function (evaluator) { return evaluator(key, seed, trafficAllocation, trafficAllocationSeed, attributes, splitEvaluator); });
31
31
  // if we find a thenable
32
32
  if (findIndex(predicateResults, thenable) !== -1) {
33
- return Promise.all(predicateResults).then(function (results) { return computeEvaluation(results); });
33
+ return Promise.all(predicateResults).then(function (results) { return computeTreatment(results); });
34
34
  }
35
- return computeEvaluation(predicateResults);
35
+ return computeTreatment(predicateResults);
36
36
  }
37
37
  // if there is none predicates, then there was an error in parsing phase
38
38
  if (!Array.isArray(predicates) || predicates.length === 0) {
@@ -4,12 +4,11 @@ import { NOT_IN_SPLIT } from '../../utils/labels';
4
4
  // Build Evaluation object if and only if matchingResult is true
5
5
  function match(log, matchingResult, bucketingKey, seed, treatments, label) {
6
6
  if (matchingResult) {
7
- return treatments ? // Feature flag
8
- {
9
- treatment: getTreatment(log, bucketingKey, seed, treatments),
10
- label: label
11
- } : // Rule-based segment
12
- true;
7
+ var treatment = getTreatment(log, bucketingKey, seed, treatments);
8
+ return {
9
+ treatment: treatment,
10
+ label: label
11
+ };
13
12
  }
14
13
  // else we should notify the engine to continue evaluating
15
14
  return undefined;
@@ -26,12 +26,12 @@ export function evaluateFeature(log, key, splitName, attributes, storage) {
26
26
  return treatmentException;
27
27
  }
28
28
  if (thenable(parsedSplit)) {
29
- return parsedSplit.then(function (split) { return getEvaluation(log, key, split, attributes, storage); }).catch(
29
+ return parsedSplit.then(function (split) { return getEvaluation(log, split, key, attributes, storage); }).catch(
30
30
  // Exception on async `getSplit` storage. For example, when the storage is redis or
31
31
  // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
32
32
  function () { return treatmentException; });
33
33
  }
34
- return getEvaluation(log, key, parsedSplit, attributes, storage);
34
+ return getEvaluation(log, parsedSplit, key, attributes, storage);
35
35
  }
36
36
  export function evaluateFeatures(log, key, splitNames, attributes, storage) {
37
37
  var parsedSplits;
@@ -43,13 +43,13 @@ export function evaluateFeatures(log, key, splitNames, attributes, storage) {
43
43
  return treatmentsException(splitNames);
44
44
  }
45
45
  return thenable(parsedSplits) ?
46
- parsedSplits.then(function (splits) { return getEvaluations(log, key, splitNames, splits, attributes, storage); })
46
+ parsedSplits.then(function (splits) { return getEvaluations(log, splitNames, splits, key, attributes, storage); })
47
47
  .catch(function () {
48
48
  // Exception on async `getSplits` storage. For example, when the storage is redis or
49
49
  // pluggable and there is a connection issue and we can't retrieve the split to be evaluated
50
50
  return treatmentsException(splitNames);
51
51
  }) :
52
- getEvaluations(log, key, splitNames, parsedSplits, attributes, storage);
52
+ getEvaluations(log, splitNames, parsedSplits, key, attributes, storage);
53
53
  }
54
54
  export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, method) {
55
55
  var storedFlagNames;
@@ -84,7 +84,7 @@ export function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, stora
84
84
  }) :
85
85
  evaluate(storedFlagNames);
86
86
  }
87
- function getEvaluation(log, key, splitJSON, attributes, storage) {
87
+ function getEvaluation(log, splitJSON, key, attributes, storage) {
88
88
  var evaluation = {
89
89
  treatment: CONTROL,
90
90
  label: SPLIT_NOT_FOUND,
@@ -110,11 +110,11 @@ function getEvaluation(log, key, splitJSON, attributes, storage) {
110
110
  }
111
111
  return evaluation;
112
112
  }
113
- function getEvaluations(log, key, splitNames, splits, attributes, storage) {
113
+ function getEvaluations(log, splitNames, splits, key, attributes, storage) {
114
114
  var result = {};
115
115
  var thenables = [];
116
116
  splitNames.forEach(function (splitName) {
117
- var evaluation = getEvaluation(log, key, splits[splitName], attributes, storage);
117
+ var evaluation = getEvaluation(log, splits[splitName], key, attributes, storage);
118
118
  if (thenable(evaluation)) {
119
119
  thenables.push(evaluation.then(function (res) {
120
120
  result[splitName] = res;
@@ -21,7 +21,6 @@ import { greaterThanEqualToSemverMatcherContext } from './semver_gte';
21
21
  import { lessThanEqualToSemverMatcherContext } from './semver_lte';
22
22
  import { betweenSemverMatcherContext } from './semver_between';
23
23
  import { inListSemverMatcherContext } from './semver_inlist';
24
- import { ruleBasedSegmentMatcherContext } from './rbsegment';
25
24
  var matchers = [
26
25
  undefined,
27
26
  allMatcherContext,
@@ -46,8 +45,7 @@ var matchers = [
46
45
  lessThanEqualToSemverMatcherContext,
47
46
  betweenSemverMatcherContext,
48
47
  inListSemverMatcherContext,
49
- largeSegmentMatcherContext,
50
- ruleBasedSegmentMatcherContext // IN_RULE_BASED_SEGMENT: 24
48
+ largeSegmentMatcherContext, // IN_LARGE_SEGMENT: 23
51
49
  ];
52
50
  /**
53
51
  * Matcher factory.
@@ -23,7 +23,6 @@ export var matcherTypes = {
23
23
  BETWEEN_SEMVER: 21,
24
24
  IN_LIST_SEMVER: 22,
25
25
  IN_LARGE_SEGMENT: 23,
26
- IN_RULE_BASED_SEGMENT: 24,
27
26
  };
28
27
  export var matcherDataTypes = {
29
28
  BOOLEAN: 'BOOLEAN',
@@ -78,10 +78,6 @@ export function matchersTransform(matchers) {
78
78
  type === matcherTypes.LESS_THAN_OR_EQUAL_TO_SEMVER) {
79
79
  value = stringMatcherData;
80
80
  }
81
- else if (type === matcherTypes.IN_RULE_BASED_SEGMENT) {
82
- value = segmentTransform(userDefinedSegmentMatcherData);
83
- dataType = matcherDataTypes.NOT_SPECIFIED;
84
- }
85
81
  return {
86
82
  attribute: attribute,
87
83
  negate: negate,
@@ -50,8 +50,8 @@ export function parser(log, conditions, storage) {
50
50
  // and break the loop
51
51
  break;
52
52
  }
53
- predicates.push(conditionContext(log, andCombinerContext(log, expressions), partitions && Treatments.parse(partitions), label, conditionType));
53
+ predicates.push(conditionContext(log, andCombinerContext(log, expressions), Treatments.parse(partitions), label, conditionType));
54
54
  }
55
- // Instantiate evaluator given the set of conditions using if else if logic
55
+ // Instanciate evaluator given the set of conditions using if else if logic
56
56
  return ifElseIfCombinerContext(log, predicates);
57
57
  }
@@ -49,7 +49,6 @@ function getProcessingFunction(matcherTypeID, dataType) {
49
49
  case matcherTypes.BETWEEN:
50
50
  return dataType === 'DATETIME' ? zeroSinceSS : undefined;
51
51
  case matcherTypes.IN_SPLIT_TREATMENT:
52
- case matcherTypes.IN_RULE_BASED_SEGMENT:
53
52
  return dependencyProcessor;
54
53
  default:
55
54
  return undefined;
@@ -21,7 +21,6 @@ export var RETRIEVE_MANAGER = 29;
21
21
  export var SYNC_OFFLINE_DATA = 30;
22
22
  export var SYNC_SPLITS_FETCH = 31;
23
23
  export var SYNC_SPLITS_UPDATE = 32;
24
- export var SYNC_RBS_UPDATE = 33;
25
24
  export var STREAMING_NEW_MESSAGE = 35;
26
25
  export var SYNC_TASK_START = 36;
27
26
  export var SYNC_TASK_EXECUTE = 37;
@@ -19,9 +19,8 @@ export var codesDebug = codesInfo.concat([
19
19
  [c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
20
20
  // synchronizer
21
21
  [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
22
- [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s and rbSince = %s.'],
23
- [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s.'],
24
- [c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments %s. Removed rule-based segments %s.'],
22
+ [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s'],
23
+ [c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s. Segment names collected %s'],
25
24
  [c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
26
25
  [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
27
26
  [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
@@ -31,7 +31,7 @@ export var codesWarn = codesError.concat([
31
31
  [c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
32
32
  [c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
33
33
  [c.STREAMING_PARSING_MEMBERSHIPS_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching Memberships due to an error processing %s notification: %s'],
34
- [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
34
+ [c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
35
35
  [c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
36
36
  [c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
37
37
  [c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in the Split user interface.'],
@@ -5,7 +5,7 @@ import { telemetryTrackerFactory } from '../trackers/telemetryTracker';
5
5
  import { validateAndTrackApiKey } from '../utils/inputValidation/apiKey';
6
6
  import { createLoggerAPI } from '../logger/sdkLogger';
7
7
  import { NEW_FACTORY, RETRIEVE_MANAGER } from '../logger/constants';
8
- import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED } from '../readiness/constants';
8
+ import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../readiness/constants';
9
9
  import { objectAssign } from '../utils/lang/objectAssign';
10
10
  import { strategyDebugFactory } from '../trackers/strategy/strategyDebug';
11
11
  import { strategyOptimizedFactory } from '../trackers/strategy/strategyOptimized';
@@ -42,6 +42,9 @@ export function sdkFactory(params) {
42
42
  readiness.splits.emit(SDK_SPLITS_ARRIVED);
43
43
  readiness.segments.emit(SDK_SEGMENTS_ARRIVED);
44
44
  },
45
+ onReadyFromCacheCb: function () {
46
+ readiness.splits.emit(SDK_SPLITS_CACHE_LOADED);
47
+ }
45
48
  });
46
49
  // @TODO add support for dataloader: `if (params.dataLoader) params.dataLoader(storage);`
47
50
  var clients = {};
@@ -17,6 +17,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
17
17
  var urls = settings.urls;
18
18
  var filterQueryString = settings.sync.__splitFiltersValidation && settings.sync.__splitFiltersValidation.queryString;
19
19
  var SplitSDKImpressionsMode = settings.sync.impressionsMode;
20
+ var flagSpecVersion = settings.sync.flagSpecVersion;
20
21
  var splitHttpClient = splitHttpClientFactory(settings, platform);
21
22
  return {
22
23
  // @TODO throw errors if health check requests fail, to log them in the Synchronizer
@@ -29,7 +30,7 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
29
30
  return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
30
31
  },
31
32
  fetchAuth: function (userMatchingKeys) {
32
- var url = urls.auth + "/v2/auth?s=" + settings.sync.flagSpecVersion;
33
+ var url = urls.auth + "/v2/auth?s=" + flagSpecVersion;
33
34
  if (userMatchingKeys) { // `userMatchingKeys` is undefined in server-side
34
35
  var queryParams = userMatchingKeys.map(userKeyToQueryParam).join('&');
35
36
  if (queryParams)
@@ -37,8 +38,8 @@ export function splitApiFactory(settings, platform, telemetryTracker) {
37
38
  }
38
39
  return splitHttpClient(url, undefined, telemetryTracker.trackHttp(TOKEN));
39
40
  },
40
- fetchSplitChanges: function (since, noCache, till, rbSince) {
41
- var url = urls.sdk + "/splitChanges?s=" + settings.sync.flagSpecVersion + "&since=" + since + (rbSince ? '&rbSince=' + rbSince : '') + (filterQueryString || '') + (till ? '&till=' + till : '');
41
+ fetchSplitChanges: function (since, noCache, till) {
42
+ var url = urls.sdk + "/splitChanges?s=" + flagSpecVersion + "&since=" + since + (filterQueryString || '') + (till ? '&till=' + till : '');
42
43
  return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS))
43
44
  .catch(function (err) {
44
45
  if (err.statusCode === 414)
@@ -50,8 +50,8 @@ export { AbstractSplitsCacheSync };
50
50
  * Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
51
51
  * This util is intended to simplify the implementation of `splitsCache::usesSegments` method
52
52
  */
53
- export function usesSegments(ruleEntity) {
54
- var conditions = ruleEntity.conditions || [];
53
+ export function usesSegments(split) {
54
+ var conditions = split.conditions || [];
55
55
  for (var i = 0; i < conditions.length; i++) {
56
56
  var matchers = conditions[i].matcherGroup.matchers;
57
57
  for (var j = 0; j < matchers.length; j++) {
@@ -60,8 +60,5 @@ export function usesSegments(ruleEntity) {
60
60
  return true;
61
61
  }
62
62
  }
63
- var excluded = ruleEntity.excluded;
64
- if (excluded && excluded.segments && excluded.segments.length > 0)
65
- return true;
66
63
  return false;
67
64
  }
@@ -24,15 +24,6 @@ var KeyBuilder = /** @class */ (function () {
24
24
  KeyBuilder.prototype.buildSplitKeyPrefix = function () {
25
25
  return this.prefix + ".split.";
26
26
  };
27
- KeyBuilder.prototype.buildRBSegmentKey = function (rbsegmentName) {
28
- return this.prefix + ".rbsegment." + rbsegmentName;
29
- };
30
- KeyBuilder.prototype.buildRBSegmentsTillKey = function () {
31
- return this.prefix + ".rbsegments.till";
32
- };
33
- KeyBuilder.prototype.buildRBSegmentKeyPrefix = function () {
34
- return this.prefix + ".rbsegment.";
35
- };
36
27
  KeyBuilder.prototype.buildSegmentNameKey = function (segmentName) {
37
28
  return this.prefix + ".segment." + segmentName;
38
29
  };
@@ -32,9 +32,6 @@ var KeyBuilderCS = /** @class */ (function (_super) {
32
32
  KeyBuilderCS.prototype.isSplitKey = function (key) {
33
33
  return startsWith(key, this.prefix + ".split.");
34
34
  };
35
- KeyBuilderCS.prototype.isRBSegmentKey = function (key) {
36
- return startsWith(key, this.prefix + ".rbsegment.");
37
- };
38
35
  KeyBuilderCS.prototype.buildSplitsWithSegmentCountKey = function () {
39
36
  return this.prefix + ".splits.usingSegments";
40
37
  };
@@ -39,9 +39,6 @@ var KeyBuilderSS = /** @class */ (function (_super) {
39
39
  KeyBuilderSS.prototype.searchPatternForSplitKeys = function () {
40
40
  return this.buildSplitKeyPrefix() + "*";
41
41
  };
42
- KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () {
43
- return this.buildRBSegmentKeyPrefix() + "*";
44
- };
45
42
  /* Telemetry keys */
46
43
  KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) {
47
44
  return this.latencyPrefix + "::" + this.versionablePrefix + "/" + METHOD_NAMES[method] + "/" + bucket;
@@ -38,13 +38,15 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
38
38
  };
39
39
  SplitsCacheInLocal.prototype._incrementCounts = function (split) {
40
40
  try {
41
- var ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
42
- // @ts-expect-error
43
- localStorage.setItem(ttKey, toNumber(localStorage.getItem(ttKey)) + 1);
44
- if (usesSegments(split)) {
45
- var segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
41
+ if (split) {
42
+ var ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
46
43
  // @ts-expect-error
47
- localStorage.setItem(segmentsCountKey, toNumber(localStorage.getItem(segmentsCountKey)) + 1);
44
+ localStorage.setItem(ttKey, toNumber(localStorage.getItem(ttKey)) + 1);
45
+ if (usesSegments(split)) {
46
+ var segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
47
+ // @ts-expect-error
48
+ localStorage.setItem(segmentsCountKey, toNumber(localStorage.getItem(segmentsCountKey)) + 1);
49
+ }
48
50
  }
49
51
  }
50
52
  catch (e) {
@@ -153,9 +155,12 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
153
155
  return true;
154
156
  var storedCount = localStorage.getItem(this.keys.buildSplitsWithSegmentCountKey());
155
157
  var splitsWithSegmentsCount = storedCount === null ? 0 : toNumber(storedCount);
156
- return isFiniteNumber(splitsWithSegmentsCount) ?
157
- splitsWithSegmentsCount > 0 :
158
- true;
158
+ if (isFiniteNumber(splitsWithSegmentsCount)) {
159
+ return splitsWithSegmentsCount > 0;
160
+ }
161
+ else {
162
+ return true;
163
+ }
159
164
  };
160
165
  SplitsCacheInLocal.prototype.getNamesByFlagSets = function (flagSets) {
161
166
  var _this = this;
@@ -5,7 +5,6 @@ import { validatePrefix } from '../KeyBuilder';
5
5
  import { KeyBuilderCS, myLargeSegmentsKeyBuilder } from '../KeyBuilderCS';
6
6
  import { isLocalStorageAvailable } from '../../utils/env/isLocalStorageAvailable';
7
7
  import { SplitsCacheInLocal } from './SplitsCacheInLocal';
8
- import { RBSegmentsCacheInLocal } from './RBSegmentsCacheInLocal';
9
8
  import { MySegmentsCacheInLocal } from './MySegmentsCacheInLocal';
10
9
  import { InMemoryStorageCSFactory } from '../inMemory/InMemoryStorageCS';
11
10
  import { LOG_PREFIX } from './constants';
@@ -30,12 +29,10 @@ export function InLocalStorage(options) {
30
29
  var matchingKey = getMatching(settings.core.key);
31
30
  var keys = new KeyBuilderCS(prefix, matchingKey);
32
31
  var splits = new SplitsCacheInLocal(settings, keys);
33
- var rbSegments = new RBSegmentsCacheInLocal(settings, keys);
34
32
  var segments = new MySegmentsCacheInLocal(log, keys);
35
33
  var largeSegments = new MySegmentsCacheInLocal(log, myLargeSegmentsKeyBuilder(prefix, matchingKey));
36
34
  return {
37
35
  splits: splits,
38
- rbSegments: rbSegments,
39
36
  segments: segments,
40
37
  largeSegments: largeSegments,
41
38
  impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
@@ -44,14 +41,13 @@ export function InLocalStorage(options) {
44
41
  telemetry: shouldRecordTelemetry(params) ? new TelemetryCacheInMemory(splits, segments) : undefined,
45
42
  uniqueKeys: new UniqueKeysCacheInMemoryCS(),
46
43
  validateCache: function () {
47
- return validateCache(options, settings, keys, splits, rbSegments, segments, largeSegments);
44
+ return validateCache(options, settings, keys, splits, segments, largeSegments);
48
45
  },
49
46
  destroy: function () { },
50
47
  // When using shared instantiation with MEMORY we reuse everything but segments (they are customer per key).
51
48
  shared: function (matchingKey) {
52
49
  return {
53
50
  splits: this.splits,
54
- rbSegments: this.rbSegments,
55
51
  segments: new MySegmentsCacheInLocal(log, new KeyBuilderCS(prefix, matchingKey)),
56
52
  largeSegments: new MySegmentsCacheInLocal(log, myLargeSegmentsKeyBuilder(prefix, matchingKey)),
57
53
  impressions: this.impressions,
@@ -54,12 +54,11 @@ function validateExpiration(options, settings, keys, currentTimestamp, isThereCa
54
54
  *
55
55
  * @returns `true` if cache is ready to be used, `false` otherwise (cache was cleared or there is no cache)
56
56
  */
57
- export function validateCache(options, settings, keys, splits, rbSegments, segments, largeSegments) {
57
+ export function validateCache(options, settings, keys, splits, segments, largeSegments) {
58
58
  var currentTimestamp = Date.now();
59
59
  var isThereCache = splits.getChangeNumber() > -1;
60
60
  if (validateExpiration(options, settings, keys, currentTimestamp, isThereCache)) {
61
61
  splits.clear();
62
- rbSegments.clear();
63
62
  segments.clear();
64
63
  largeSegments.clear();
65
64
  // Update last clear timestamp
@@ -6,7 +6,6 @@ import { ImpressionCountsCacheInMemory } from './ImpressionCountsCacheInMemory';
6
6
  import { LOCALHOST_MODE, STORAGE_MEMORY } from '../../utils/constants';
7
7
  import { shouldRecordTelemetry, TelemetryCacheInMemory } from './TelemetryCacheInMemory';
8
8
  import { UniqueKeysCacheInMemory } from './UniqueKeysCacheInMemory';
9
- import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
10
9
  /**
11
10
  * InMemory storage factory for standalone server-side SplitFactory
12
11
  *
@@ -15,11 +14,9 @@ import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
15
14
  export function InMemoryStorageFactory(params) {
16
15
  var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, __splitFiltersValidation = _a.sync.__splitFiltersValidation;
17
16
  var splits = new SplitsCacheInMemory(__splitFiltersValidation);
18
- var rbSegments = new RBSegmentsCacheInMemory();
19
17
  var segments = new SegmentsCacheInMemory();
20
18
  var storage = {
21
19
  splits: splits,
22
- rbSegments: rbSegments,
23
20
  segments: segments,
24
21
  impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
25
22
  impressionCounts: new ImpressionCountsCacheInMemory(),
@@ -6,7 +6,6 @@ import { ImpressionCountsCacheInMemory } from './ImpressionCountsCacheInMemory';
6
6
  import { LOCALHOST_MODE, STORAGE_MEMORY } from '../../utils/constants';
7
7
  import { shouldRecordTelemetry, TelemetryCacheInMemory } from './TelemetryCacheInMemory';
8
8
  import { UniqueKeysCacheInMemoryCS } from './UniqueKeysCacheInMemoryCS';
9
- import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
10
9
  /**
11
10
  * InMemory storage factory for standalone client-side SplitFactory
12
11
  *
@@ -15,12 +14,10 @@ import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
15
14
  export function InMemoryStorageCSFactory(params) {
16
15
  var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, __splitFiltersValidation = _a.sync.__splitFiltersValidation;
17
16
  var splits = new SplitsCacheInMemory(__splitFiltersValidation);
18
- var rbSegments = new RBSegmentsCacheInMemory();
19
17
  var segments = new MySegmentsCacheInMemory();
20
18
  var largeSegments = new MySegmentsCacheInMemory();
21
19
  var storage = {
22
20
  splits: splits,
23
- rbSegments: rbSegments,
24
21
  segments: segments,
25
22
  largeSegments: largeSegments,
26
23
  impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
@@ -33,7 +30,6 @@ export function InMemoryStorageCSFactory(params) {
33
30
  shared: function () {
34
31
  return {
35
32
  splits: this.splits,
36
- rbSegments: this.rbSegments,
37
33
  segments: new MySegmentsCacheInMemory(),
38
34
  largeSegments: new MySegmentsCacheInMemory(),
39
35
  impressions: this.impressions,
@@ -9,25 +9,32 @@ import { TelemetryCacheInRedis } from './TelemetryCacheInRedis';
9
9
  import { UniqueKeysCacheInRedis } from './UniqueKeysCacheInRedis';
10
10
  import { ImpressionCountsCacheInRedis } from './ImpressionCountsCacheInRedis';
11
11
  import { metadataBuilder } from '../utils';
12
- import { RBSegmentsCacheInRedis } from './RBSegmentsCacheInRedis';
12
+ var RD;
13
+ try {
14
+ // Using `require` to prevent error when bundling or importing the SDK in a .mjs file, since ioredis is a CommonJS module.
15
+ // Redis storage is not supported with .mjs files.
16
+ RD = require('./RedisAdapter').RedisAdapter;
17
+ }
18
+ catch (error) { /* empty */ }
13
19
  /**
14
20
  * InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.js
15
21
  * @see {@link https://www.npmjs.com/package/ioredis}
16
22
  */
17
23
  export function InRedisStorage(options) {
18
24
  if (options === void 0) { options = {}; }
19
- // Lazy loading to prevent error when bundling or importing the SDK in a .mjs file, since ioredis is a CommonJS module.
20
- // Redis storage is not supported with .mjs files.
21
- var RD = require('./RedisAdapter').RedisAdapter;
22
25
  var prefix = validatePrefix(options.prefix);
23
26
  function InRedisStorageFactory(params) {
24
- var onReadyCb = params.onReadyCb, settings = params.settings, log = params.settings.log;
27
+ if (!RD)
28
+ throw new Error('The SDK Redis storage is not available. Your runtime environment must support CommonJS (`require`) to import the ioredis dependency.');
29
+ var onReadyFromCacheCb = params.onReadyFromCacheCb, onReadyCb = params.onReadyCb, settings = params.settings, log = params.settings.log;
25
30
  var metadata = metadataBuilder(settings);
26
31
  var keys = new KeyBuilderSS(prefix, metadata);
27
32
  var redisClient = new RD(log, options.options || {});
28
33
  var telemetry = new TelemetryCacheInRedis(log, keys, redisClient);
29
34
  var impressionCountsCache = new ImpressionCountsCacheInRedis(log, keys.buildImpressionsCountKey(), redisClient);
30
35
  var uniqueKeysCache = new UniqueKeysCacheInRedis(log, keys.buildUniqueKeysKey(), redisClient);
36
+ // RedisAdapter queues operations before connection
37
+ onReadyFromCacheCb();
31
38
  // subscription to Redis connect event in order to emit SDK_READY event on consumer mode
32
39
  redisClient.on('connect', function () {
33
40
  onReadyCb();
@@ -38,7 +45,6 @@ export function InRedisStorage(options) {
38
45
  });
39
46
  return {
40
47
  splits: new SplitsCacheInRedis(log, keys, redisClient, settings.sync.__splitFiltersValidation),
41
- rbSegments: new RBSegmentsCacheInRedis(log, keys, redisClient),
42
48
  segments: new SegmentsCacheInRedis(log, keys, redisClient),
43
49
  impressions: new ImpressionsCacheInRedis(log, keys.buildImpressionsKey(), redisClient, metadata),
44
50
  impressionCounts: impressionCountsCache,
@@ -19,7 +19,6 @@ import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
19
19
  import { UniqueKeysCacheInMemoryCS } from '../inMemory/UniqueKeysCacheInMemoryCS';
20
20
  import { metadataBuilder } from '../utils';
21
21
  import { LOG_PREFIX } from '../pluggable/constants';
22
- import { RBSegmentsCachePluggable } from './RBSegmentsCachePluggable';
23
22
  var NO_VALID_WRAPPER = 'Expecting pluggable storage `wrapper` in options, but no valid wrapper instance was provided.';
24
23
  var NO_VALID_WRAPPER_INTERFACE = 'The provided wrapper instance doesn’t follow the expected interface. Check our docs.';
25
24
  /**
@@ -103,7 +102,6 @@ export function PluggableStorage(options) {
103
102
  });
104
103
  return {
105
104
  splits: new SplitsCachePluggable(log, keys, wrapper, settings.sync.__splitFiltersValidation),
106
- rbSegments: new RBSegmentsCachePluggable(log, keys, wrapper),
107
105
  segments: new SegmentsCachePluggable(log, keys, wrapper),
108
106
  impressions: isPartialConsumer ? new ImpressionsCacheInMemory(impressionsQueueSize) : new ImpressionsCachePluggable(log, keys.buildImpressionsKey(), wrapper, metadata),
109
107
  impressionCounts: impressionCountsCache,
@@ -1,61 +1,14 @@
1
- import { FLAG_SPEC_VERSION } from '../../../utils/constants';
2
- import { base } from '../../../utils/settingsValidation';
3
- import { LOG_PREFIX_SYNC_SPLITS } from '../../../logger/constants';
4
- var PROXY_CHECK_INTERVAL_MILLIS_CS = 60 * 60 * 1000; // 1 hour in Client Side
5
- var PROXY_CHECK_INTERVAL_MILLIS_SS = 24 * PROXY_CHECK_INTERVAL_MILLIS_CS; // 24 hours in Server Side
6
- function sdkEndpointOverriden(settings) {
7
- return settings.urls.sdk !== base.urls.sdk;
8
- }
9
1
  /**
10
2
  * Factory of SplitChanges fetcher.
11
3
  * SplitChanges fetcher is a wrapper around `splitChanges` API service that parses the response and handle errors.
12
4
  */
13
- // @TODO breaking: drop support for Split Proxy below v5.10.0 and simplify the implementation
14
- export function splitChangesFetcherFactory(fetchSplitChanges, settings, storage) {
15
- var log = settings.log;
16
- var PROXY_CHECK_INTERVAL_MILLIS = settings.core.key !== undefined ? PROXY_CHECK_INTERVAL_MILLIS_CS : PROXY_CHECK_INTERVAL_MILLIS_SS;
17
- var lastProxyCheckTimestamp;
18
- return function splitChangesFetcher(since, noCache, till, rbSince,
5
+ export function splitChangesFetcherFactory(fetchSplitChanges) {
6
+ return function splitChangesFetcher(since, noCache, till,
19
7
  // Optional decorator for `fetchSplitChanges` promise, such as timeout or time tracker
20
8
  decorator) {
21
- // Recheck proxy
22
- if (lastProxyCheckTimestamp && (Date.now() - lastProxyCheckTimestamp) > PROXY_CHECK_INTERVAL_MILLIS) {
23
- settings.sync.flagSpecVersion = FLAG_SPEC_VERSION;
24
- }
25
- var splitsPromise = fetchSplitChanges(since, noCache, till, settings.sync.flagSpecVersion === FLAG_SPEC_VERSION ? rbSince : undefined)
26
- // Handle proxy error with spec 1.3
27
- .catch(function (err) {
28
- if (err.statusCode === 400 && sdkEndpointOverriden(settings) && settings.sync.flagSpecVersion === FLAG_SPEC_VERSION) {
29
- log.error(LOG_PREFIX_SYNC_SPLITS + 'Proxy error detected. If you are using Split Proxy, please upgrade to latest version');
30
- lastProxyCheckTimestamp = Date.now();
31
- settings.sync.flagSpecVersion = '1.2'; // fallback to 1.2 spec
32
- return fetchSplitChanges(since, noCache, till); // retry request without rbSince
33
- }
34
- throw err;
35
- });
9
+ var splitsPromise = fetchSplitChanges(since, noCache, till);
36
10
  if (decorator)
37
11
  splitsPromise = decorator(splitsPromise);
38
- return splitsPromise
39
- .then(function (resp) { return resp.json(); })
40
- .then(function (data) {
41
- // Using flag spec version 1.2
42
- if (data.splits) {
43
- return {
44
- ff: {
45
- d: data.splits,
46
- s: data.since,
47
- t: data.till
48
- }
49
- };
50
- }
51
- // Proxy recovery
52
- if (lastProxyCheckTimestamp) {
53
- log.info(LOG_PREFIX_SYNC_SPLITS + 'Proxy error recovered');
54
- lastProxyCheckTimestamp = undefined;
55
- return Promise.all([storage.splits.clear(), storage.rbSegments.clear()])
56
- .then(function () { return splitChangesFetcher(storage.splits.getChangeNumber(), undefined, undefined, storage.rbSegments.getChangeNumber()); });
57
- }
58
- return data;
59
- });
12
+ return splitsPromise.then(function (resp) { return resp.json(); });
60
13
  };
61
14
  }
@@ -31,10 +31,10 @@ export function pollingManagerCSFactory(params) {
31
31
  readiness.splits.on(SDK_SPLITS_ARRIVED, function () {
32
32
  if (!splitsSyncTask.isRunning())
33
33
  return; // noop if not doing polling
34
- var usingSegments = storage.splits.usesSegments() || storage.rbSegments.usesSegments();
35
- if (usingSegments !== mySegmentsSyncTask.isRunning()) {
36
- log.info(POLLING_SMART_PAUSING, [usingSegments ? 'ON' : 'OFF']);
37
- if (usingSegments) {
34
+ var splitsHaveSegments = storage.splits.usesSegments();
35
+ if (splitsHaveSegments !== mySegmentsSyncTask.isRunning()) {
36
+ log.info(POLLING_SMART_PAUSING, [splitsHaveSegments ? 'ON' : 'OFF']);
37
+ if (splitsHaveSegments) {
38
38
  startMySegmentsSyncTasks();
39
39
  }
40
40
  else {
@@ -46,10 +46,10 @@ export function pollingManagerCSFactory(params) {
46
46
  var mySegmentsSyncTask = mySegmentsSyncTaskFactory(splitApi.fetchMemberships, storage, readiness, settings, matchingKey);
47
47
  // smart ready
48
48
  function smartReady() {
49
- if (!readiness.isReady() && !storage.splits.usesSegments() && !storage.rbSegments.usesSegments())
49
+ if (!readiness.isReady() && !storage.splits.usesSegments())
50
50
  readiness.segments.emit(SDK_SEGMENTS_ARRIVED);
51
51
  }
52
- if (!storage.splits.usesSegments() && !storage.rbSegments.usesSegments())
52
+ if (!storage.splits.usesSegments())
53
53
  setTimeout(smartReady, 0);
54
54
  else
55
55
  readiness.splits.once(SDK_SPLITS_ARRIVED, smartReady);
@@ -63,7 +63,7 @@ export function pollingManagerCSFactory(params) {
63
63
  start: function () {
64
64
  log.info(POLLING_START);
65
65
  splitsSyncTask.start();
66
- if (storage.splits.usesSegments() || storage.rbSegments.usesSegments())
66
+ if (storage.splits.usesSegments())
67
67
  startMySegmentsSyncTasks();
68
68
  },
69
69
  // Stop periodic fetching (polling)
@@ -5,5 +5,5 @@ import { splitChangesUpdaterFactory } from '../updaters/splitChangesUpdater';
5
5
  * Creates a sync task that periodically executes a `splitChangesUpdater` task
6
6
  */
7
7
  export function splitsSyncTaskFactory(fetchSplitChanges, storage, readiness, settings, isClientSide) {
8
- return syncTaskFactory(settings.log, splitChangesUpdaterFactory(settings.log, splitChangesFetcherFactory(fetchSplitChanges, settings, storage), storage, settings.sync.__splitFiltersValidation, readiness.splits, settings.startup.requestTimeoutBeforeReady, settings.startup.retriesOnFailureBeforeReady, isClientSide), settings.scheduler.featuresRefreshRate, 'splitChangesUpdater');
8
+ return syncTaskFactory(settings.log, splitChangesUpdaterFactory(settings.log, splitChangesFetcherFactory(fetchSplitChanges), storage, settings.sync.__splitFiltersValidation, readiness.splits, settings.startup.requestTimeoutBeforeReady, settings.startup.retriesOnFailureBeforeReady, isClientSide), settings.scheduler.featuresRefreshRate, 'splitChangesUpdater');
9
9
  }