splitclient-rb 8.9.0.pre.rc1-java → 8.10.0.pre.rc1-java

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: dd476a208526c32175e7a10e734b1d2c8068e12e762694af6da1a40692f2f17a
4
- data.tar.gz: 161d0703482b5ac2f6b63eed534aa116591a17e11659575cfc7332a99401a40c
3
+ metadata.gz: 41a9eb981eedd8411383990ed81c62b417500607a7bb7a6837ab3f942ed818b6
4
+ data.tar.gz: 36b3f64cf73a6d7e75217d1383a2b03280f060b26eaebdef00329a21cbd6bcb1
5
5
  SHA512:
6
- metadata.gz: dac3c87167c3fb35bb06a7f3210a34fdcb3dd4524062947dc3a8afeff14c9ae7d20b17fa2855d62267959eb88f41904beb94684a3cd94ac6f076e1ff2cb08768
7
- data.tar.gz: 8c36c12b0d57af4a5a243af76dac0efb004b587f441230c31306be58da95f3a4baa1d138588f43b92c1f5cb408678bd7d49c499c5f4841e19e117e58ae401772
6
+ metadata.gz: 99b1c75caddc34771ba23c732b858024348f16d8bdab18f0ca33450d2776a6c3bdf905d11b5d91c8beaa96beef31553edc95871764ef728aecf76f9f9a1a4d6b
7
+ data.tar.gz: eb054a12c4b4f8c73d95ffc9fa1769794a6d685671eb9b215f9f20601dfabfd4b99580c3aee12f7763975509e285272c2046abb067581416a37d027b1db9e1ec
data/CHANGES.txt CHANGED
@@ -1,5 +1,8 @@
1
1
  CHANGES
2
2
 
3
+ 8.9.0 (Oct 8, 2025)
4
+ - Added new configuration for Fallback Treatments, which allows setting a treatment value and optional config to be returned in place of "control", either globally or by flag. Read more in our docs.
5
+
3
6
  8.8.0 (Sep 26, 2025)
4
7
  - Added a maximum size payload when posting unique keys telemetry in batches
5
8
 
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- require 'socketry'
3
+ require 'socket'
4
+ require 'openssl'
4
5
  require 'uri'
6
+ require 'timeout'
5
7
 
6
8
  module SplitIoClient
7
9
  module SSE
@@ -36,12 +38,12 @@ module SplitIoClient
36
38
 
37
39
  def close(status = nil)
38
40
  unless connected?
39
- @config.logger.error('SSEClient already disconected.') if @config.debug_enabled
41
+ log_if_debug('SSEClient already disconected.', 3)
40
42
  return
41
43
  end
42
44
 
43
45
  @connected.make_false
44
- @socket&.close
46
+ @socket.close
45
47
  push_status(status)
46
48
  rescue StandardError => e
47
49
  @config.logger.error("SSEClient close Error: #{e.inspect}")
@@ -74,30 +76,40 @@ module SplitIoClient
74
76
 
75
77
  def connect_thread(latch)
76
78
  @config.threads[:connect_stream] = Thread.new do
77
- @config.logger.info('Starting connect_stream thread ...') if @config.debug_enabled
79
+ log_if_debug('Starting connect_stream thread ...', 2)
78
80
  new_status = connect_stream(latch)
79
81
  push_status(new_status)
80
- @config.logger.info('connect_stream thread finished.') if @config.debug_enabled
82
+ log_if_debug('connect_stream thread finished.', 2)
81
83
  end
82
84
  end
83
85
 
84
86
  def connect_stream(latch)
85
87
  return Constants::PUSH_NONRETRYABLE_ERROR unless socket_write(latch)
86
-
87
88
  while connected? || @first_event.value
88
89
  begin
89
- partial_data = @socket.readpartial(10_000, timeout: @read_timeout)
90
-
90
+ partial_data = ""
91
+ Timeout::timeout @read_timeout do
92
+ partial_data = @socket.readpartial(10_000)
93
+ end
91
94
  read_first_event(partial_data, latch)
92
95
 
93
96
  raise 'eof exception' if partial_data == :eof
97
+ rescue Timeout::Error => e
98
+ log_if_debug("SSE read operation timed out!: #{e.inspect}", 3)
99
+ return Constants::PUSH_RETRYABLE_ERROR
100
+ rescue EOFError
101
+ raise 'eof exception'
102
+ rescue Errno::EAGAIN => e
103
+ log_if_debug("SSE client transient error: #{e.inspect}", 1)
104
+ IO.select([tcp_socket])
105
+ retry
94
106
  rescue Errno::EBADF, IOError => e
95
- @config.logger.error(e.inspect) if @config.debug_enabled
107
+ log_if_debug(e.inspect, 3)
96
108
  return nil
97
109
  rescue StandardError => e
98
110
  return nil if ENV['SPLITCLIENT_ENV'] == 'test'
99
111
 
100
- @config.logger.error("Error reading partial data: #{e.inspect}") if @config.debug_enabled
112
+ log_if_debug("Error reading partial data: #{e.inspect}", 3)
101
113
  return Constants::PUSH_RETRYABLE_ERROR
102
114
  end
103
115
 
@@ -109,10 +121,10 @@ module SplitIoClient
109
121
  def socket_write(latch)
110
122
  @first_event.make_true
111
123
  @socket = socket_connect
112
- @socket.write(build_request(@uri))
124
+ @socket.puts(build_request(@uri))
113
125
  true
114
126
  rescue StandardError => e
115
- @config.logger.error("Error during connecting to #{@uri.host}. Error: #{e.inspect}")
127
+ log_if_debug("Error during connecting to #{@uri.host}. Error: #{e.inspect}", 3)
116
128
  latch.count_down
117
129
  false
118
130
  end
@@ -138,15 +150,28 @@ module SplitIoClient
138
150
  end
139
151
 
140
152
  def socket_connect
141
- return Socketry::SSL::Socket.connect(@uri.host, @uri.port) if @uri.scheme.casecmp('https').zero?
153
+ tcp_socket = TCPSocket.new(@uri.host, @uri.port)
154
+ if @uri.scheme.casecmp('https').zero?
155
+ begin
156
+ ssl_context = OpenSSL::SSL::SSLContext.new
157
+ ssl_socket = OpenSSL::SSL::SSLSocket.new(tcp_socket, ssl_context)
158
+ ssl_socket.hostname = @uri.host
159
+ ssl_socket.connect
160
+ return ssl_socket.connect
161
+ rescue Exception => e
162
+ @config.logger.error("socket connect error: #{e.inspect}")
163
+ puts e.inspect
164
+ return nil
165
+ end
166
+ end
142
167
 
143
- Socketry::TCP::Socket.connect(@uri.host, @uri.port)
168
+ tcp_socket
144
169
  end
145
170
 
146
171
  def process_data(partial_data)
147
172
  return if partial_data.nil? || partial_data == KEEP_ALIVE_RESPONSE
148
173
 
149
- @config.logger.debug("Event partial data: #{partial_data}") if @config.debug_enabled
174
+ log_if_debug("Event partial data: #{partial_data}", 1)
150
175
  events = @event_parser.parse(partial_data)
151
176
  events.each { |event| process_event(event) }
152
177
  rescue StandardError => e
@@ -162,7 +187,7 @@ module SplitIoClient
162
187
  req << "SplitSDKMachineName: #{@config.machine_name}\r\n"
163
188
  req << "SplitSDKClientKey: #{@api_key.split(//).last(4).join}\r\n" unless @api_key.nil?
164
189
  req << "Cache-Control: no-cache\r\n\r\n"
165
- @config.logger.debug("Request info: #{req}") if @config.debug_enabled
190
+ log_if_debug("Request info: #{req}", 1)
166
191
  req
167
192
  end
168
193
 
@@ -200,6 +225,19 @@ module SplitIoClient
200
225
  @config.logger.debug("Pushing new sse status: #{status}")
201
226
  @status_queue.push(status)
202
227
  end
228
+
229
+ def log_if_debug(text, level)
230
+ if @config.debug_enabled
231
+ case level
232
+ when 1
233
+ @config.logger.debug(text)
234
+ when 2
235
+ @config.logger.info(text)
236
+ else
237
+ @config.logger.error(text)
238
+ end
239
+ end
240
+ end
203
241
  end
204
242
  end
205
243
  end
@@ -57,8 +57,12 @@ module SplitIoClient
57
57
  end
58
58
  without_nil = Array.new
59
59
  flag_sets.each { |flag_set|
60
- without_nil.push(flag_set) if !flag_set.nil?
61
- log_nil("flag set", method) if flag_set.nil?
60
+ if !flag_set.nil?
61
+ without_nil.push(flag_set)
62
+ next
63
+ end
64
+
65
+ log_nil("flag set", method)
62
66
  }
63
67
  if without_nil.length() == 0
64
68
  log_invalid_flag_set_type(method)
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '8.9.0-rc1'
2
+ VERSION = '8.10.0-rc1'
3
3
  end
@@ -59,6 +59,5 @@ Gem::Specification.new do |spec|
59
59
  spec.add_runtime_dependency 'lru_redux', '~> 1.1'
60
60
  spec.add_runtime_dependency 'net-http-persistent', '>= 2.9', '< 5.0'
61
61
  spec.add_runtime_dependency 'redis', '>= 4.0.0', '< 6.0'
62
- spec.add_runtime_dependency 'socketry', '>= 0.4', '< 1.0'
63
62
  spec.add_runtime_dependency 'thread_safe', '~> 0.3'
64
63
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.9.0.pre.rc1
4
+ version: 8.10.0.pre.rc1
5
5
  platform: java
6
6
  authors:
7
7
  - Split Software
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-08 00:00:00.000000000 Z
10
+ date: 2025-10-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: allocation_stats
@@ -361,26 +361,6 @@ dependencies:
361
361
  - - "<"
362
362
  - !ruby/object:Gem::Version
363
363
  version: '6.0'
364
- - !ruby/object:Gem::Dependency
365
- name: socketry
366
- requirement: !ruby/object:Gem::Requirement
367
- requirements:
368
- - - ">="
369
- - !ruby/object:Gem::Version
370
- version: '0.4'
371
- - - "<"
372
- - !ruby/object:Gem::Version
373
- version: '1.0'
374
- type: :runtime
375
- prerelease: false
376
- version_requirements: !ruby/object:Gem::Requirement
377
- requirements:
378
- - - ">="
379
- - !ruby/object:Gem::Version
380
- version: '0.4'
381
- - - "<"
382
- - !ruby/object:Gem::Version
383
- version: '1.0'
384
364
  - !ruby/object:Gem::Dependency
385
365
  name: thread_safe
386
366
  requirement: !ruby/object:Gem::Requirement