splitclient-rb 8.7.0.pre.rc1 → 8.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c85b34f29d10419bece593d2fba243af50018066df596fd6ce8148bf5efad3e7
4
- data.tar.gz: 517f903385d103f0f2fb8e891818cf265d38b68f6fa6cceb2a8f2ec6e7f1614f
3
+ metadata.gz: a2929d92bdc4d732f21bb8e104316555b0ca458c2eb21df7ecb957d6b1412d65
4
+ data.tar.gz: 2be266d8b0948a68faa96c01b24e964308616a32927e27dfb64e1a37f6afbff6
5
5
  SHA512:
6
- metadata.gz: 56b74ff1ca58929b8756b313222388dab12908028810a64776802febc4541c8f9ff0c40512615b9135726e9c704f067ed572ba12e5d67bf59f1eb743940a9df1
7
- data.tar.gz: 3b842bf4f5c6fe6e82255ffb0427b358773f094fef76e2500a7dd013162f0ca44e36678af4f2494b5ac25a0df55ae80740bbda2b0c83a7d191ac481c1624f7bc
6
+ metadata.gz: b35604f7de21d0a4a164f07ff42c7930c932977be704cef2d924d87561453a137f0a320fc48e4501f4eb8576fe4f11250062fd8383d5886d7368df6d1d570f36
7
+ data.tar.gz: 234c3dd2fd93e34f6348d51177676e950a38e0f628924294c1a72d31cb48e5ae80381a322d15cd7e8d651119c556dbc9b8e965c861ee386b79ff1c3d984c7d39
@@ -0,0 +1,40 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ "release" ]
6
+ pull_request:
7
+ branches: [ "release" ]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ packages: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Ruby 2.5.8
20
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
21
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
22
+ # uses: ruby/setup-ruby@v1
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: 2.5.8
26
+
27
+ - name: Publish to RubyGems
28
+ run: |
29
+ mkdir -p $HOME/.gem
30
+ touch $HOME/.gem/credentials
31
+ chmod 0600 $HOME/.gem/credentials
32
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
+ gem build *.gemspec
34
+ # gem push *.gem
35
+ - name: upload gem file
36
+ uses: actions/upload-artifact@v4
37
+ with:
38
+ name: gemspec
39
+ path: ./*.gem
40
+
data/CHANGES.txt CHANGED
@@ -1,7 +1,10 @@
1
1
  CHANGES
2
2
 
3
+ 8.8.0 (Sep 26, 2025)
4
+ - Added a maximum size payload when posting unique keys telemetry in batches
5
+
3
6
  8.7.0 (Aug 1, 2025)
4
- - Added support for feature flag prerequisites. This allows customers to define dependency conditions between flags, which are evaluated before any allowlists or targeting rules.
7
+ - Added a new optional argument to the client `getTreatment` methods to allow passing additional evaluation options, such as a map of properties to append to the generated impressions sent to Split backend. Read more in our docs.
5
8
 
6
9
  8.6.0 (Jun 17, 2025)
7
10
  - Added support for rule-based segments. These segments determine membership at runtime by evaluating their configured rules against the user attributes provided to the SDK.
@@ -14,9 +14,9 @@ module SplitIoClient
14
14
  @filter_adapter = filter_adapter
15
15
  @sender_adapter = sender_adapter
16
16
  @cache = cache
17
- @cache_max_size = config.unique_keys_cache_max_size
18
17
  @max_bulk_size = config.unique_keys_bulk_size
19
18
  @semaphore = Mutex.new
19
+ @keys_size = 0
20
20
  end
21
21
 
22
22
  def call
@@ -30,8 +30,9 @@ module SplitIoClient
30
30
  @filter_adapter.add(feature_name, key)
31
31
 
32
32
  add_or_update(feature_name, key)
33
+ @keys_size += 1
33
34
 
34
- send_bulk_data if @cache.size >= @cache_max_size
35
+ send_bulk_data if @keys_size >= @max_bulk_size
35
36
 
36
37
  true
37
38
  rescue StandardError => e
@@ -70,27 +71,73 @@ module SplitIoClient
70
71
  end
71
72
  end
72
73
 
74
+ def clear_cache
75
+ uniques = @cache.clone
76
+ keys_size = @keys_size
77
+ @cache.clear
78
+ @keys_size = 0
79
+
80
+ [uniques, keys_size]
81
+ end
82
+
73
83
  def send_bulk_data
74
84
  @semaphore.synchronize do
75
85
  return if @cache.empty?
76
86
 
77
- uniques = @cache.clone
78
- @cache.clear
79
-
80
- if uniques.size <= @max_bulk_size
87
+ uniques, keys_size = clear_cache
88
+ if keys_size <= @max_bulk_size
81
89
  @sender_adapter.record_uniques_key(uniques)
82
90
  return
83
- end
84
-
85
- bulks = SplitIoClient::Utilities.split_bulk_to_send(uniques, uniques.size / @max_bulk_size)
86
91
 
87
- bulks.each do |b|
88
- @sender_adapter.record_uniques_key(b)
89
92
  end
93
+ bulks = flatten_bulks(uniques)
94
+ bulks_to_post = group_bulks_by_max_size(bulks)
95
+ @sender_adapter.record_uniques_key(bulks_to_post)
90
96
  end
91
97
  rescue StandardError => e
92
98
  @config.log_found_exception(__method__.to_s, e)
93
99
  end
100
+
101
+ def group_bulks_by_max_size(bulks)
102
+ current_size = 0
103
+ bulks_to_post = Concurrent::Hash.new
104
+ bulks.each do |bulk|
105
+ key, value = bulk.first
106
+ if (value.size + current_size) > @max_bulk_size
107
+ @sender_adapter.record_uniques_key(bulks_to_post)
108
+ bulks_to_post = Concurrent::Hash.new
109
+ current_size = 0
110
+ end
111
+ bulks_to_post[key] = value
112
+ current_size += value.size
113
+ end
114
+
115
+ bulks_to_post
116
+ end
117
+
118
+ def flatten_bulks(uniques)
119
+ bulks = []
120
+ uniques.each_key do |unique_key|
121
+ bulks += check_keys_and_split_to_bulks(uniques[unique_key], unique_key)
122
+ end
123
+
124
+ bulks
125
+ end
126
+
127
+ def check_keys_and_split_to_bulks(value, key)
128
+ unique_updated = []
129
+ if value.size > @max_bulk_size
130
+ sub_bulks = SplitIoClient::Utilities.split_bulk_to_send(value, @max_bulk_size)
131
+ sub_bulks.each do |sub_bulk|
132
+ unique_updated << { key => sub_bulk.to_set }
133
+ end
134
+ return unique_updated
135
+
136
+ end
137
+ unique_updated << { key => value }
138
+
139
+ unique_updated
140
+ end
94
141
  end
95
142
  end
96
143
  end
@@ -112,7 +112,7 @@ module SplitIoClient
112
112
  @telemetry_service_url = opts[:telemetry_service_url] || SplitConfig.default_telemetry_service_url
113
113
 
114
114
  @unique_keys_refresh_rate = SplitConfig.default_unique_keys_refresh_rate(@cache_adapter)
115
- @unique_keys_cache_max_size = SplitConfig.default_unique_keys_cache_max_size
115
+ # @unique_keys_cache_max_size = SplitConfig.default_unique_keys_cache_max_size
116
116
  @unique_keys_bulk_size = SplitConfig.default_unique_keys_bulk_size(@cache_adapter)
117
117
 
118
118
  @counter_refresh_rate = SplitConfig.default_counter_refresh_rate(@cache_adapter)
@@ -292,7 +292,7 @@ module SplitIoClient
292
292
  attr_accessor :on_demand_fetch_max_retries
293
293
 
294
294
  attr_accessor :unique_keys_refresh_rate
295
- attr_accessor :unique_keys_cache_max_size
295
+ #attr_accessor :unique_keys_cache_max_size
296
296
  attr_accessor :unique_keys_bulk_size
297
297
 
298
298
  attr_accessor :counter_refresh_rate
@@ -498,9 +498,9 @@ module SplitIoClient
498
498
  900
499
499
  end
500
500
 
501
- def self.default_unique_keys_cache_max_size
502
- 30000
503
- end
501
+ # def self.default_unique_keys_cache_max_size
502
+ # 30000
503
+ # end
504
504
 
505
505
  def self.default_unique_keys_bulk_size(adapter)
506
506
  return 2000 if adapter == :redis
@@ -38,16 +38,12 @@ module SplitIoClient
38
38
  interval * random_factor
39
39
  end
40
40
 
41
- def split_bulk_to_send(hash, divisions)
42
- count = 0
43
-
44
- hash.each_with_object([]) do |key_value, final|
45
- final[count % divisions] ||= {}
46
- final[count % divisions][key_value[0]] = key_value[1]
47
- count += 1
48
- end
49
- rescue StandardError
50
- []
41
+ def split_bulk_to_send(items, divisions)
42
+ to_return = []
43
+ items.to_a.each_slice(divisions) {|bulk|
44
+ to_return.push(bulk.to_set)
45
+ }
46
+ to_return
51
47
  end
52
48
  end
53
49
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '8.7.0-rc1'
2
+ VERSION = '8.8.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.7.0.pre.rc1
4
+ version: 8.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Split Software
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-09-26 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: allocation_stats
@@ -406,6 +407,7 @@ files:
406
407
  - ".github/CODEOWNERS"
407
408
  - ".github/pull_request_template.md"
408
409
  - ".github/workflows/ci.yml"
410
+ - ".github/workflows/gem-push.yml"
409
411
  - ".github/workflows/update-license-year.yml"
410
412
  - ".gitignore"
411
413
  - ".rubocop.yml"
@@ -579,6 +581,7 @@ homepage: https://github.com/splitio/ruby-client
579
581
  licenses:
580
582
  - Apache-2.0
581
583
  metadata: {}
584
+ post_install_message:
582
585
  rdoc_options: []
583
586
  require_paths:
584
587
  - lib
@@ -593,7 +596,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
593
596
  - !ruby/object:Gem::Version
594
597
  version: '0'
595
598
  requirements: []
596
- rubygems_version: 3.7.1
599
+ rubyforge_project:
600
+ rubygems_version: 2.7.6.2
601
+ signing_key:
597
602
  specification_version: 4
598
603
  summary: Ruby client for split SDK.
599
604
  test_files: []