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

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
  SHA1:
3
- metadata.gz: fcc68876cf1a07553cf46556730756ad389623cb
4
- data.tar.gz: 0eca775e395657074a50b88d7370f68331a87891
3
+ metadata.gz: 967ac13ea5a9ebfc1ba22869010fe2996e8af399
4
+ data.tar.gz: 8f38579fa0e4bd5220d8ff050178df8e7317bd2a
5
5
  SHA512:
6
- metadata.gz: 8cdd2e8d1d05701b39d2a7de81198f67a4eafd5fa369e2fa973ab93aafd5e015fc4d60e0cd51c8acd36102e4fd0f280cc9850b93018923fd94d177ad990d5b57
7
- data.tar.gz: 4c88d82a01595d986203a756e5952d7b5b3e3c0b73cbf1524bbea112e2e0fdc4205de1218a32242bb73f7c0fc9120e3405df525f047a9cfbbf845a0fedd2e02b
6
+ metadata.gz: d9b66788f9ca970e98233386a68607638ac6be83bc6f15d1921d86596fcc3b74479549a26b037d8061c5b842aa4d0bbfa2fd4bc574dd70587325c971d6153e6d
7
+ data.tar.gz: c8e7656ebf927bae70ad2c19b7b7be635ca55f5c0fff3745faa7b18f7a5ac7276fa16e3ee0f3a8a13402653e65c664d0339852e5ee82f8b86914ad8dd6e80d93
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,74 @@ 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
42
41
 
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)
42
+ def return_split_from_json(notification)
43
+ JSON.parse(
44
+ SplitIoClient::Helpers::DecryptionHelper.get_encoded_definition(
45
+ notification.data['c'],
46
+ notification.data['d']
47
+ ),
48
+ symbolize_names: true
49
+ )
46
50
  end
47
51
 
48
- private
52
+ def check_update(notification)
53
+ @feature_flags_repository.get_change_number == notification.data['pcn'] && !notification.data['d'].nil?
54
+ end
55
+
56
+ def update_feature_flag(notification)
57
+ return if @feature_flags_repository.get_change_number.to_i > notification.data['changeNumber']
58
+
59
+ if check_update(notification)
60
+ begin
61
+ new_split = return_split_from_json(notification)
62
+ if SplitIoClient::Engine::Models::Split.archived?(new_split)
63
+ @feature_flags_repository.remove_split(new_split)
64
+ else
65
+ @feature_flags_repository.add_split(new_split)
66
+ end
67
+ @feature_flags_repository.set_change_number(notification.data['changeNumber'])
68
+ return
69
+ rescue StandardError => e
70
+ @config.logger.debug("Failed to update Split: #{e.inspect}") if @config.debug_enabled
71
+ end
72
+ end
73
+ @synchronizer.fetch_splits(notification.data['changeNumber'])
74
+ end
75
+
76
+ def kill_feature_flag(notification)
77
+ return if @feature_flags_repository.get_change_number.to_i > notification.data['changeNumber']
78
+
79
+ @config.logger.debug("feature_flags_worker kill #{notification.data['splitName']}, #{notification.data['changeNumber']}")
80
+ @feature_flags_repository.kill(
81
+ notification.data['changeNumber'],
82
+ notification.data['splitName'],
83
+ notification.data['defaultTreatment']
84
+ )
85
+ @synchronizer.fetch_splits(notification.data['changeNumber'])
86
+ end
49
87
 
50
88
  def perform
51
- while (change_number = @queue.pop)
52
- @config.logger.debug("SplitsWorker change_number dequeue #{change_number}")
53
- @synchronizer.fetch_splits(change_number)
89
+ while (notification = @queue.pop)
90
+ @config.logger.debug("feature_flags_worker change_number dequeue #{notification.data['changeNumber']}")
91
+ case notification.data['type']
92
+ when SSE::EventSource::EventTypes::SPLIT_UPDATE
93
+ update_feature_flag(notification)
94
+ when SSE::EventSource::EventTypes::SPLIT_KILL
95
+ kill_feature_flag(notification)
96
+ end
54
97
  end
55
98
  end
56
99
 
57
100
  def perform_thread
58
101
  @config.threads[:split_update_worker] = Thread.new do
59
- @config.logger.debug('Starting splits worker ...') if @config.debug_enabled
102
+ @config.logger.debug('starting feature_flags_worker ...') if @config.debug_enabled
60
103
  perform
61
104
  end
62
105
  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.rc2'
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'
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_development_dependency 'allocation_stats', '~> 0.1'
39
39
  spec.add_development_dependency 'bundler', '~> 2.2'
40
+ spec.add_development_dependency 'byebug', '~> 11.1'
40
41
  spec.add_development_dependency 'pry', '~> 0.14'
41
42
  spec.add_development_dependency 'pry-nav', '~> 1.0'
42
43
  spec.add_development_dependency 'rake', '~> 13.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.rc2
5
5
  platform: java
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-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.2'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '11.1'
47
+ name: byebug
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '11.1'
41
55
  - !ruby/object:Gem::Dependency
42
56
  requirement: !ruby/object:Gem::Requirement
43
57
  requirements:
@@ -498,6 +512,7 @@ files:
498
512
  - lib/splitclient-rb/engine/sync_manager.rb
499
513
  - lib/splitclient-rb/engine/synchronizer.rb
500
514
  - lib/splitclient-rb/exceptions.rb
515
+ - lib/splitclient-rb/helpers/decryption_helper.rb
501
516
  - lib/splitclient-rb/helpers/thread_helper.rb
502
517
  - lib/splitclient-rb/managers/split_manager.rb
503
518
  - lib/splitclient-rb/split_config.rb