splitclient-rb 8.1.2.pre.rc1 → 8.1.3.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dc55fea71b927bd6fd872ea6ceae9f2a28e68df75abab73a3d03be5c9018a2c
4
- data.tar.gz: 759416c234e9d4cf8baf938b144c8780b896bfdf6bc350af3328269b65984073
3
+ metadata.gz: 9a0ec791812addfdc81c560cc797d8c1e8e457fb7087622c2f891166725c4dcd
4
+ data.tar.gz: 95d672b4f213ebaac3e12073fcdafcf29aa15f7b4d1c2c5df573e30f545e9b51
5
5
  SHA512:
6
- metadata.gz: bb2a069489452c745013a4276649cace56061905c38b053be9fd51c44d3781d35c7a3641e64efd05e01cee03499f7ee6fe56415d6c450685800cf99eb20ea67d
7
- data.tar.gz: 1125ee18d63b79ff61b94863a9c1855936db4ffeee82fad131206f518d099beabe88672dc9d67cca7bd47e345c78e355f9b7627eb5e1b08cb0acb31f3327917d
6
+ metadata.gz: 3c9c1d2fb2239e9efdf33d725cfee6a99104b995767812820b2b80e3b863e4f3a087d4a0b84191b4d45e2c8779e41e405f2592a2aa9e49048787f06f6c5e4ac7
7
+ data.tar.gz: 20288247d0976a7b8468b8a5c190612283df8f23a5360841bb9ec21990715efa2c5582fdfd9ae5fe8de7948ac969aa95aa3e80bc231902cffd7391558a8dcf1a
data/CHANGES.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  CHANGES
2
2
 
3
3
  8.1.2 (May 15, 2023)
4
- - Updated terminology on the SDKs codebase to be more aligned with current standard without causing a breaking change. The core change is the term split for feature flag on things like logs and intensense comments.
4
+ - Updated terminology on the SDKs codebase to be more aligned with current standard without causing a breaking change. The core change is the term split for feature flag on things like logs and IntelliSense comments.
5
5
 
6
6
  8.1.1 (Mar 17, 2023)
7
7
  - Added retries with backoff when the sdk tries to connect to the Streaming service and it is not available.
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Split SDK for Ruby
2
- ![Build Status](https://github.com/splitio/ruby-client/actions/workflows/ci.yml/badge.svg?branch=master)
2
+ [![build status](https://github.com/splitio/ruby-client/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/splitio/ruby-client/actions)
3
+ [![Documentation](https://img.shields.io/badge/ruby_client-documentation-informational)](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
3
4
 
4
5
  ## Overview
5
- This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via a Split feature flag to manage your complete customer experience.
6
+ This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience.
6
7
 
7
8
  [![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)
8
9
 
@@ -21,7 +22,7 @@ Below is a simple example that describes the instantiation and most basic usage
21
22
  ```ruby
22
23
  require 'splitclient-rb'
23
24
 
24
- split_factory = SplitIoClient::SplitFactory.new('SDK_API_KEY')
25
+ split_factory = SplitIoClient::SplitFactory.new('YOUR_SDK_KEY')
25
26
  split_client = split_factory.client
26
27
 
27
28
  begin
@@ -30,7 +31,7 @@ rescue SplitIoClient::SDKBlockerTimeoutExpiredException
30
31
  puts 'SDK is not ready. Decide whether to continue or abort execution'
31
32
  end
32
33
 
33
- treatment = split_client.get_treatment('CUSTOMER_ID', 'SPLIT_NAME');
34
+ treatment = split_client.get_treatment('CUSTOMER_ID', 'FEATURE_FLAG_NAME');
34
35
 
35
36
  if treatment == 'on'
36
37
  # insert code here to show on treatment
@@ -60,16 +61,21 @@ To learn more about Split, contact hello@split.io, or get started with feature f
60
61
 
61
62
  Split has built and maintains SDKs for:
62
63
 
64
+ * .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
65
+ * Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
66
+ * Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
67
+ * GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
68
+ * iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
63
69
  * Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
64
- * Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
70
+ * JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
71
+ * JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
65
72
  * Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
66
- * .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
67
- * Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
68
73
  * PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
69
74
  * Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
70
- * GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
71
- * Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
72
- * iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
75
+ * React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
76
+ * React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
77
+ * Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK)
78
+ * Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
73
79
 
74
80
  For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
75
81
 
@@ -49,12 +49,12 @@ module SplitIoClient
49
49
 
50
50
  def splits_thread
51
51
  @config.threads[:split_fetcher] = Thread.new do
52
- @config.logger.info('Starting splits fetcher service') if @config.debug_enabled
52
+ @config.logger.info('Starting feature flags fetcher service') if @config.debug_enabled
53
53
  loop do
54
54
  fetch_splits
55
55
 
56
56
  sleep_for = SplitIoClient::Cache::Stores::StoreUtils.random_interval(@config.features_refresh_rate)
57
- @config.logger.debug("Splits fetcher is sleeping for: #{sleep_for} seconds") if @config.debug_enabled
57
+ @config.logger.debug("Feature flags fetcher is sleeping for: #{sleep_for} seconds") if @config.debug_enabled
58
58
  sleep(sleep_for)
59
59
  end
60
60
  end
@@ -66,7 +66,7 @@ module SplitIoClient
66
66
 
67
67
  def add_split_unless_archived(split)
68
68
  if Engine::Models::Split.archived?(split)
69
- @config.logger.debug("Seeing archived split #{split[:name]}") if @config.debug_enabled
69
+ @config.logger.debug("Seeing archived feature flag #{split[:name]}") if @config.debug_enabled
70
70
 
71
71
  remove_archived_split(split)
72
72
  else
@@ -75,13 +75,13 @@ module SplitIoClient
75
75
  end
76
76
 
77
77
  def remove_archived_split(split)
78
- @config.logger.debug("removing split from store(#{split})") if @config.debug_enabled
78
+ @config.logger.debug("removing feature flag from store(#{split})") if @config.debug_enabled
79
79
 
80
80
  @splits_repository.remove_split(split)
81
81
  end
82
82
 
83
83
  def store_split(split)
84
- @config.logger.debug("storing split (#{split[:name]})") if @config.debug_enabled
84
+ @config.logger.debug("storing feature flag (#{split[:name]})") if @config.debug_enabled
85
85
 
86
86
  @splits_repository.add_split(split)
87
87
  end
@@ -31,7 +31,7 @@ module SplitIoClient
31
31
 
32
32
  def splits_thread
33
33
  @config.threads[:split_store] = Thread.new do
34
- @config.logger.info('Starting splits fetcher service')
34
+ @config.logger.info('Starting feature flags fetcher service')
35
35
  loop do
36
36
  store_splits
37
37
 
@@ -53,7 +53,7 @@ module SplitIoClient
53
53
  end
54
54
 
55
55
  def store_split(split)
56
- @config.logger.debug("storing split (#{split[:name]})") if @config.debug_enabled
56
+ @config.logger.debug("storing feature flag (#{split[:name]})") if @config.debug_enabled
57
57
 
58
58
  @splits_repository.add_split(split)
59
59
  end
@@ -11,11 +11,11 @@ module SplitIoClient
11
11
  #
12
12
  # Creates a new split client instance that connects to split.io API.
13
13
  #
14
- # @param api_key [String] the API key for your split account
14
+ # @param sdk_key [String] the SDK key for your split account
15
15
  #
16
16
  # @return [SplitIoClient] split.io client instance
17
- def initialize(api_key, repositories, status_manager, config, impressions_manager, telemetry_evaluation_producer)
18
- @api_key = api_key
17
+ def initialize(sdk_key, repositories, status_manager, config, impressions_manager, telemetry_evaluation_producer)
18
+ @api_key = sdk_key
19
19
  @splits_repository = repositories[:splits]
20
20
  @segments_repository = repositories[:segments]
21
21
  @impressions_repository = repositories[:impressions]
@@ -103,8 +103,8 @@ module SplitIoClient
103
103
 
104
104
  if ready? && !@config.localhost_mode && !@splits_repository.traffic_type_exists(traffic_type_name)
105
105
  @config.logger.warn("track: Traffic Type #{traffic_type_name} " \
106
- "does not have any corresponding Splits in this environment, make sure you're tracking " \
107
- 'your events to a valid traffic type defined in the Split console')
106
+ "does not have any corresponding feature flags in this environment, make sure you're tracking " \
107
+ 'your events to a valid traffic type defined in the Split user interface')
108
108
  end
109
109
 
110
110
  @events_repository.add(key.to_s, traffic_type_name.downcase, event_type.to_s, (Time.now.to_f * 1000).to_i, value, properties, properties_size)
@@ -147,10 +147,10 @@ module SplitIoClient
147
147
  if (split_name.is_a?(String) || split_name.is_a?(Symbol)) && !split_name.empty?
148
148
  true
149
149
  elsif split_name.is_a?(String) && split_name.empty?
150
- @config.logger.warn("#{calling_method}: you passed an empty split_name, split_name must be a non-empty String or a Symbol")
150
+ @config.logger.warn("#{calling_method}: you passed an empty feature_flag_name, flag name must be a non-empty String or a Symbol")
151
151
  false
152
152
  else
153
- @config.logger.warn("#{calling_method}: you passed an invalid split_name, split_name must be a non-empty String or a Symbol")
153
+ @config.logger.warn("#{calling_method}: you passed an invalid feature_flag_name, flag name must be a non-empty String or a Symbol")
154
154
  false
155
155
  end
156
156
  end
@@ -200,7 +200,7 @@ module SplitIoClient
200
200
  sanitized_split_names = sanitize_split_names(calling_method, split_names)
201
201
 
202
202
  if sanitized_split_names.empty?
203
- @config.logger.error("#{calling_method}: split_names must be a non-empty Array")
203
+ @config.logger.error("#{calling_method}: feature_flag_names must be a non-empty Array")
204
204
  return {}
205
205
  end
206
206
 
@@ -258,7 +258,7 @@ module SplitIoClient
258
258
  sanitized_split_name = split_name.to_s.strip
259
259
 
260
260
  if split_name.to_s != sanitized_split_name
261
- @config.logger.warn("#{calling_method}: split_name #{split_name} has extra whitespace, trimming")
261
+ @config.logger.warn("#{calling_method}: feature_flag_name #{split_name} has extra whitespace, trimming")
262
262
  split_name = sanitized_split_name
263
263
  end
264
264
 
@@ -271,7 +271,7 @@ module SplitIoClient
271
271
 
272
272
  if split.nil? && ready?
273
273
  @config.logger.warn("#{calling_method}: you passed #{split_name} that " \
274
- 'does not exist in this environment, please double check what Splits exist in the web console')
274
+ 'does not exist in this environment, please double check what feature flags exist in the Split user interface')
275
275
 
276
276
  return parsed_treatment(multiple, control_treatment.merge({ label: Engine::Models::Label::NOT_FOUND }))
277
277
  end
@@ -20,9 +20,9 @@ module SplitIoClient
20
20
  result = splits_with_segment_names(response.body)
21
21
 
22
22
  unless result[:splits].empty?
23
- @config.split_logger.log_if_debug("#{result[:splits].length} splits retrieved. since=#{since}")
23
+ @config.split_logger.log_if_debug("#{result[:splits].length} feature flags retrieved. since=#{since}")
24
24
  end
25
- @config.split_logger.log_if_transport("Split changes response: #{result.to_s}")
25
+ @config.split_logger.log_if_transport("Feature flag changes response: #{result.to_s}")
26
26
 
27
27
  bucket = BinarySearchLatencyTracker.get_bucket((Time.now - start) * 1000.0)
28
28
  @telemetry_runtime_producer.record_sync_latency(Telemetry::Domain::Constants::SPLIT_SYNC, bucket)
@@ -32,10 +32,10 @@ module SplitIoClient
32
32
  else
33
33
  @telemetry_runtime_producer.record_sync_error(Telemetry::Domain::Constants::SPLIT_SYNC, response.status)
34
34
 
35
- @config.logger.error("Unexpected status code while fetching splits: #{response.status}. " \
35
+ @config.logger.error("Unexpected status code while fetching feature flags: #{response.status}. " \
36
36
  'Check your API key and base URI')
37
37
 
38
- raise 'Split SDK failed to connect to backend to fetch split definitions'
38
+ raise 'Split SDK failed to connect to backend to fetch feature flags definitions'
39
39
  end
40
40
  end
41
41
 
@@ -4,18 +4,18 @@ module SplitIoClient
4
4
  class DependencyMatcher
5
5
  MATCHER_TYPE = 'IN_SPLIT_TREATMENT'
6
6
 
7
- def initialize(split, treatments, logger)
8
- @split = split
7
+ def initialize(feature_flag, treatments, logger)
8
+ @feature_flag = feature_flag
9
9
  @treatments = treatments
10
10
  @logger = logger
11
11
  end
12
12
 
13
13
  def match?(args)
14
14
  keys = { matching_key: args[:matching_key], bucketing_key: args[:bucketing_key] }
15
- evaluate = args[:evaluator].call(keys, @split, args[:attributes])
15
+ evaluate = args[:evaluator].call(keys, @feature_flag, args[:attributes])
16
16
  matches = @treatments.include?(evaluate[:treatment])
17
- @logger.log_if_debug("[dependencyMatcher] Parent split #{@split} evaluated to #{evaluate[:treatment]} \
18
- with label #{evaluate[:label]}. #{@split} evaluated treatment is part of [#{@treatments}] ? #{matches}.")
17
+ @logger.log_if_debug("[dependencyMatcher] Parent feature flag #{@feature_flag} evaluated to #{evaluate[:treatment]} \
18
+ with label #{evaluate[:label]}. #{@feature_flag} evaluated treatment is part of [#{@treatments}] ? #{matches}.")
19
19
  matches
20
20
  end
21
21
 
@@ -201,7 +201,7 @@ module SplitIoClient
201
201
  end
202
202
 
203
203
  def sync_splits_and_segments
204
- @config.logger.debug('Synchronizing Splits and Segments ...') if @config.debug_enabled
204
+ @config.logger.debug('Synchronizing feature flags and segments ...') if @config.debug_enabled
205
205
  splits_result = @split_fetcher.fetch_splits
206
206
 
207
207
  splits_result[:success] && @segment_fetcher.fetch_segments
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SplitIoClient
4
+ NO_COMPRESSION = 0
5
+ GZIP_COMPRESSION = 1
6
+ ZLIB_COMPRESSION = 2
7
+
8
+ module Helpers
9
+ class DecryptionHelper
10
+ def self.get_encoded_definition(compression, data)
11
+ case compression
12
+ when NO_COMPRESSION
13
+ Base64.decode64(data)
14
+ when GZIP_COMPRESSION
15
+ gz = Zlib::GzipReader.new(StringIO.new(Base64.decode64(data)))
16
+ gz.read
17
+ when ZLIB_COMPRESSION
18
+ Zlib::Inflate.inflate(Base64.decode64(data))
19
+ else
20
+ raise StandardError, 'Compression flag value is incorrect'
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -50,31 +50,31 @@ module SplitIoClient
50
50
  # method to get a split view
51
51
  #
52
52
  # @returns a split view
53
- def split(split_name)
54
- return unless @config.valid_mode && @splits_repository && @config.split_validator.valid_split_parameters(split_name)
53
+ def split(feature_flag_name)
54
+ return unless @config.valid_mode && @splits_repository && @config.split_validator.valid_split_parameters(feature_flag_name)
55
55
 
56
56
  if !ready?
57
57
  @config.logger.error("split: the SDK is not ready, the operation cannot be executed")
58
58
  return
59
59
  end
60
60
 
61
- sanitized_split_name= split_name.to_s.strip
61
+ sanitized_feature_flag_name = feature_flag_name.to_s.strip
62
62
 
63
- if split_name.to_s != sanitized_split_name
64
- @config.logger.warn("split: split_name #{split_name} has extra whitespace, trimming")
65
- split_name = sanitized_split_name
63
+ if feature_flag_name.to_s != sanitized_feature_flag_name
64
+ @config.logger.warn("split: feature_flag_name #{feature_flag_name} has extra whitespace, trimming")
65
+ feature_flag_name = sanitized_feature_flag_name
66
66
  end
67
67
 
68
- split = @splits_repository.get_split(split_name)
68
+ split = @splits_repository.get_split(feature_flag_name)
69
69
 
70
70
  if ready? && split.nil?
71
- @config.logger.warn("split: you passed #{split_name} " \
72
- 'that does not exist in this environment, please double check what Splits exist in the web console')
71
+ @config.logger.warn("split: you passed #{feature_flag_name} " \
72
+ 'that does not exist in this environment, please double check what feature flags exist in the Split user interface')
73
73
  end
74
74
 
75
75
  return if split.nil? || Engine::Models::Split.archived?(split)
76
76
 
77
- build_split_view(split_name, split)
77
+ build_split_view(feature_flag_name, split)
78
78
  end
79
79
 
80
80
  def block_until_ready(time = nil)
@@ -26,16 +26,12 @@ module SplitIoClient
26
26
 
27
27
  def process_split_update(notification)
28
28
  @config.logger.debug("SPLIT UPDATE notification received: #{notification}") if @config.debug_enabled
29
- @splits_worker.add_to_queue(notification.data['changeNumber'])
29
+ @splits_worker.add_to_queue(notification)
30
30
  end
31
31
 
32
32
  def process_split_kill(notification)
33
33
  @config.logger.debug("SPLIT KILL notification received: #{notification}") if @config.debug_enabled
34
- change_number = notification.data['changeNumber']
35
- default_treatment = notification.data['defaultTreatment']
36
- split_name = notification.data['splitName']
37
-
38
- @splits_worker.kill_split(change_number, split_name, default_treatment)
34
+ @splits_worker.add_to_queue(notification)
39
35
  end
40
36
 
41
37
  def process_segment_update(notification)
@@ -4,17 +4,17 @@ module SplitIoClient
4
4
  module SSE
5
5
  module Workers
6
6
  class SplitsWorker
7
- def initialize(synchronizer, config, splits_repository)
7
+ def initialize(synchronizer, config, feature_flags_repository)
8
8
  @synchronizer = synchronizer
9
9
  @config = config
10
- @splits_repository = splits_repository
10
+ @feature_flags_repository = feature_flags_repository
11
11
  @queue = Queue.new
12
12
  @running = Concurrent::AtomicBoolean.new(false)
13
13
  end
14
14
 
15
15
  def start
16
16
  if @running.value
17
- @config.logger.debug('splits worker already running.')
17
+ @config.logger.debug('feature_flags_worker already running.')
18
18
  return
19
19
  end
20
20
 
@@ -24,7 +24,7 @@ module SplitIoClient
24
24
 
25
25
  def stop
26
26
  unless @running.value
27
- @config.logger.debug('splits worker not running.')
27
+ @config.logger.debug('feature_flags_worker not running.')
28
28
  return
29
29
  end
30
30
 
@@ -32,31 +32,63 @@ module SplitIoClient
32
32
  SplitIoClient::Helpers::ThreadHelper.stop(:split_update_worker, @config)
33
33
  end
34
34
 
35
- def add_to_queue(change_number)
36
- @config.logger.debug("SplitsWorker add to queue #{change_number}")
37
- @queue.push(change_number)
35
+ def add_to_queue(notification)
36
+ @config.logger.debug("feature_flags_worker add to queue #{notification.data['changeNumber']}")
37
+ @queue.push(notification)
38
38
  end
39
39
 
40
- def kill_split(change_number, split_name, default_treatment)
41
- return if @splits_repository.get_change_number.to_i > change_number
40
+ private
41
+
42
+ def update_feature_flag(notification)
43
+ return if @feature_flags_repository.get_change_number.to_i > notification.data['changeNumber']
42
44
 
43
- @config.logger.debug("SplitsWorker kill #{split_name}, #{change_number}")
44
- @splits_repository.kill(change_number, split_name, default_treatment)
45
- add_to_queue(change_number)
45
+ if @feature_flags_repository.get_change_number == notification.data['pcn']
46
+ begin
47
+ @feature_flags_repository.add_split(
48
+ JSON.parse(
49
+ SplitIoClient::Helpers::DecryptionHelper.get_encoded_definition(
50
+ notification.data['c'],
51
+ notification.data['d']
52
+ ),
53
+ symbolize_names: true
54
+ )
55
+ )
56
+ @feature_flags_repository.set_change_number(notification.data['changeNumber'])
57
+ return
58
+ rescue StandardError => e
59
+ @config.logger.debug("Failed to update Split: #{e.inspect}") if @config.debug_enabled
60
+ end
61
+ end
62
+ @synchronizer.fetch_splits(notification.data['changeNumber'])
46
63
  end
47
64
 
48
- private
65
+ def kill_feature_flag(notification)
66
+ return if @feature_flags_repository.get_change_number.to_i > notification.data['changeNumber']
67
+
68
+ @config.logger.debug("feature_flags_worker kill #{notification.data['splitName']}, #{notification.data['changeNumber']}")
69
+ @feature_flags_repository.kill(
70
+ notification.data['changeNumber'],
71
+ notification.data['splitName'],
72
+ notification.data['defaultTreatment']
73
+ )
74
+ @synchronizer.fetch_splits(notification.data['changeNumber'])
75
+ end
49
76
 
50
77
  def perform
51
- while (change_number = @queue.pop)
52
- @config.logger.debug("SplitsWorker change_number dequeue #{change_number}")
53
- @synchronizer.fetch_splits(change_number)
78
+ while (notification = @queue.pop)
79
+ @config.logger.debug("feature_flags_worker change_number dequeue #{notification.data['changeNumber']}")
80
+ case notification.data['type']
81
+ when SSE::EventSource::EventTypes::SPLIT_UPDATE
82
+ update_feature_flag(notification)
83
+ when SSE::EventSource::EventTypes::SPLIT_KILL
84
+ kill_feature_flag(notification)
85
+ end
54
86
  end
55
87
  end
56
88
 
57
89
  def perform_thread
58
90
  @config.threads[:split_update_worker] = Thread.new do
59
- @config.logger.debug('Starting splits worker ...') if @config.debug_enabled
91
+ @config.logger.debug('starting feature_flags_worker ...') if @config.debug_enabled
60
92
  perform
61
93
  end
62
94
  end
@@ -156,7 +156,7 @@ module SplitIoClient
156
156
 
157
157
  def valid_split_names?(method, split_names)
158
158
  unless !split_names.nil? && split_names.is_a?(Array)
159
- @config.logger.error("#{method}: split_names must be a non-empty Array")
159
+ @config.logger.error("#{method}: feature_flag_names must be a non-empty Array")
160
160
  return false
161
161
  end
162
162
 
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '8.1.2.pre.rc1'
2
+ VERSION = '8.1.3.pre.rc1'
3
3
  end
@@ -41,6 +41,7 @@ require 'splitclient-rb/cache/stores/store_utils'
41
41
  require 'splitclient-rb/clients/split_client'
42
42
  require 'splitclient-rb/managers/split_manager'
43
43
  require 'splitclient-rb/helpers/thread_helper'
44
+ require 'splitclient-rb/helpers/decryption_helper'
44
45
  require 'splitclient-rb/split_factory'
45
46
  require 'splitclient-rb/split_factory_builder'
46
47
  require 'splitclient-rb/split_config'
@@ -48,6 +48,7 @@ Gem::Specification.new do |spec|
48
48
  spec.add_development_dependency 'timecop', '~> 0.9'
49
49
  spec.add_development_dependency 'webmock', '~> 3.14'
50
50
  spec.add_development_dependency 'webrick', '~> 1.7'
51
+ spec.add_development_dependency 'byebug', '~> 11.1'
51
52
 
52
53
  spec.add_runtime_dependency 'bitarray', '~> 1.3'
53
54
  spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.2.pre.rc1
4
+ version: 8.1.3.pre.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-12 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: allocation_stats
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '1.7'
195
+ - !ruby/object:Gem::Dependency
196
+ name: byebug
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '11.1'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '11.1'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: bitarray
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -503,6 +517,7 @@ files:
503
517
  - lib/splitclient-rb/engine/sync_manager.rb
504
518
  - lib/splitclient-rb/engine/synchronizer.rb
505
519
  - lib/splitclient-rb/exceptions.rb
520
+ - lib/splitclient-rb/helpers/decryption_helper.rb
506
521
  - lib/splitclient-rb/helpers/thread_helper.rb
507
522
  - lib/splitclient-rb/managers/split_manager.rb
508
523
  - lib/splitclient-rb/split_config.rb