Skip to content

Commit 2c32af6

Browse files
authored
Merge pull request #480 from splitio/development
[8.2.0] Development into Main
2 parents cb9e20b + 7d21bb3 commit 2c32af6

40 files changed

+620
-155
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @splitio/sdk

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
matrix:
2828
version:
2929
- '2.5.0'
30-
- '3.1.1'
30+
- '3.2.2'
3131

3232
steps:
3333
- name: Checkout code
@@ -56,7 +56,7 @@ jobs:
5656
run: echo "VERSION=$(cat lib/splitclient-rb/version.rb | grep VERSION | awk -F "'" '{print $2}')" >> $GITHUB_ENV
5757

5858
- name: SonarQube Scan (Push)
59-
if: matrix.version == '3.1.1' && github.event_name == 'push'
59+
if: matrix.version == '3.2.2' && github.event_name == 'push'
6060
uses: SonarSource/[email protected]
6161
env:
6262
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
@@ -68,7 +68,7 @@ jobs:
6868
-Dsonar.projectVersion=${{ env.VERSION }}
6969
7070
- name: SonarQube Scan (Pull Request)
71-
if: matrix.version == '3.1.1' && github.event_name == 'pull_request'
71+
if: matrix.version == '3.2.2' && github.event_name == 'pull_request'
7272
uses: SonarSource/[email protected]
7373
env:
7474
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
CHANGES
22

3+
8.2.0 (Jul 18, 2023)
4+
- Improved streaming architecture implementation to apply feature flag updates from the notification received which is now enhanced, improving efficiency and reliability of the whole update system.
5+
36
8.1.2 (May 15, 2023)
47
- 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.
58

lib/splitclient-rb.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
require 'splitclient-rb/clients/split_client'
4242
require 'splitclient-rb/managers/split_manager'
4343
require 'splitclient-rb/helpers/thread_helper'
44+
require 'splitclient-rb/helpers/decryption_helper'
45+
require 'splitclient-rb/helpers/util'
4446
require 'splitclient-rb/split_factory'
4547
require 'splitclient-rb/split_factory_builder'
4648
require 'splitclient-rb/split_config'

lib/splitclient-rb/engine/api/splits.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,11 @@ def splits_with_segment_names(splits_json)
4646

4747
parsed_splits[:segment_names] =
4848
parsed_splits[:splits].each_with_object(Set.new) do |split, splits|
49-
splits << segment_names(split)
49+
splits << Helpers::Util.segment_names_by_feature_flag(split)
5050
end.flatten
5151

5252
parsed_splits
5353
end
54-
55-
def segment_names(split)
56-
split[:conditions].each_with_object(Set.new) do |condition, names|
57-
condition[:matcherGroup][:matchers].each do |matcher|
58-
next if matcher[:userDefinedSegmentMatcherData].nil?
59-
60-
names << matcher[:userDefinedSegmentMatcherData][:segmentName]
61-
end
62-
end
63-
end
6454
end
6555
end
6656
end

lib/splitclient-rb/engine/push_manager.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def start_sse
3333

3434
def stop_sse
3535
@sse_handler.stop
36+
SplitIoClient::Helpers::ThreadHelper.stop(:schedule_next_token_refresh, @config)
3637
rescue StandardError => e
3738
@config.logger.error(e.inspect)
3839
end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

lib/splitclient-rb/helpers/util.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module SplitIoClient
4+
module Helpers
5+
class Util
6+
def self.segment_names_by_feature_flag(feature_flag)
7+
feature_flag[:conditions].each_with_object(Set.new) do |condition, names|
8+
condition[:matcherGroup][:matchers].each do |matcher|
9+
next if matcher[:userDefinedSegmentMatcherData].nil?
10+
11+
names << matcher[:userDefinedSegmentMatcherData][:segmentName]
12+
end
13+
end
14+
end
15+
end
16+
end
17+
end

lib/splitclient-rb/split_config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def init_impressions_mode(impressions_mode, adapter)
320320
return :debug
321321
else
322322
default = adapter == :redis ? :debug : :optimized
323-
@logger.error("You passed an invalid impressions_mode, impressions_mode should be one of the following values: :debug, :optimized or :none. Defaulting to #{default} mode")
323+
@logger.error("You passed an invalid impressions_mode, impressions_mode should be one of the following values: :debug, :optimized or :none. Defaulting to #{default} mode") unless impressions_mode.nil?
324324
return default
325325
end
326326
end

lib/splitclient-rb/split_factory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def build_synchronizer
184184

185185
def build_streaming_components
186186
@push_status_queue = Queue.new
187-
splits_worker = SSE::Workers::SplitsWorker.new(@synchronizer, @config, @splits_repository)
187+
splits_worker = SSE::Workers::SplitsWorker.new(@synchronizer, @config, @splits_repository, @runtime_producer, @segment_fetcher)
188188
segments_worker = SSE::Workers::SegmentsWorker.new(@synchronizer, @config, @segments_repository)
189189
notification_manager_keeper = SSE::NotificationManagerKeeper.new(@config, @runtime_producer, @push_status_queue)
190190
notification_processor = SSE::NotificationProcessor.new(@config, splits_worker, segments_worker)

0 commit comments

Comments
 (0)