splitclient-rb 8.9.0.pre.rc1-java → 8.10.0.pre.rc2-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 +4 -4
- data/CHANGES.txt +3 -0
- data/lib/splitclient-rb/sse/event_source/client.rb +64 -16
- data/lib/splitclient-rb/validators.rb +6 -2
- data/lib/splitclient-rb/version.rb +1 -1
- data/splitclient-rb.gemspec +0 -1
- metadata +2 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8137bf904d86b6f85364aaa9c90ede3f133c6b433b17c0ee7a8134c16406cb56
|
|
4
|
+
data.tar.gz: 69813d423c8554e12a908c23e22ec5a5f1d3a485244e74d3987431bbe1838048
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0faa442f6f682aa90d850e0e8cab5db387f52ddb8f1c59bf5f791e19941cf292c4f5f840f53f22a243a808ab3f976091cc7fc1eaaa62195076430a88b8dff9e
|
|
7
|
+
data.tar.gz: a381cea4c590ff6b299ea6a0ad23b79e46d2433233ead924c25e243e8fde6afea35d14e5adb9e084f9ada128d6d12ec2e7aeb542dee0d38a1fe01cf9875c59d8
|
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 '
|
|
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
|
-
|
|
41
|
+
log_if_debug('SSEClient already disconected.', 3)
|
|
40
42
|
return
|
|
41
43
|
end
|
|
42
44
|
|
|
43
45
|
@connected.make_false
|
|
44
|
-
@socket
|
|
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
|
-
|
|
79
|
+
log_if_debug('Starting connect_stream thread ...', 2)
|
|
78
80
|
new_status = connect_stream(latch)
|
|
79
81
|
push_status(new_status)
|
|
80
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
124
|
+
@socket.puts(build_request(@uri))
|
|
113
125
|
true
|
|
114
126
|
rescue StandardError => e
|
|
115
|
-
|
|
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,38 @@ module SplitIoClient
|
|
|
138
150
|
end
|
|
139
151
|
|
|
140
152
|
def socket_connect
|
|
141
|
-
|
|
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
|
+
|
|
160
|
+
begin
|
|
161
|
+
ssl_socket.connect_nonblock
|
|
162
|
+
rescue IO::WaitReadable
|
|
163
|
+
IO.select([ssl_socket])
|
|
164
|
+
retry
|
|
165
|
+
rescue IO::WaitWritable
|
|
166
|
+
IO.select(nil, [ssl_socket])
|
|
167
|
+
retry
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
return ssl_socket
|
|
171
|
+
# return ssl_socket.connect
|
|
172
|
+
rescue Exception => e
|
|
173
|
+
@config.logger.error("socket connect error: #{e.inspect}")
|
|
174
|
+
return nil
|
|
175
|
+
end
|
|
176
|
+
end
|
|
142
177
|
|
|
143
|
-
|
|
178
|
+
tcp_socket
|
|
144
179
|
end
|
|
145
180
|
|
|
146
181
|
def process_data(partial_data)
|
|
147
182
|
return if partial_data.nil? || partial_data == KEEP_ALIVE_RESPONSE
|
|
148
183
|
|
|
149
|
-
|
|
184
|
+
log_if_debug("Event partial data: #{partial_data}", 1)
|
|
150
185
|
events = @event_parser.parse(partial_data)
|
|
151
186
|
events.each { |event| process_event(event) }
|
|
152
187
|
rescue StandardError => e
|
|
@@ -162,7 +197,7 @@ module SplitIoClient
|
|
|
162
197
|
req << "SplitSDKMachineName: #{@config.machine_name}\r\n"
|
|
163
198
|
req << "SplitSDKClientKey: #{@api_key.split(//).last(4).join}\r\n" unless @api_key.nil?
|
|
164
199
|
req << "Cache-Control: no-cache\r\n\r\n"
|
|
165
|
-
|
|
200
|
+
log_if_debug("Request info: #{req}", 1)
|
|
166
201
|
req
|
|
167
202
|
end
|
|
168
203
|
|
|
@@ -200,6 +235,19 @@ module SplitIoClient
|
|
|
200
235
|
@config.logger.debug("Pushing new sse status: #{status}")
|
|
201
236
|
@status_queue.push(status)
|
|
202
237
|
end
|
|
238
|
+
|
|
239
|
+
def log_if_debug(text, level)
|
|
240
|
+
if @config.debug_enabled
|
|
241
|
+
case level
|
|
242
|
+
when 1
|
|
243
|
+
@config.logger.debug(text)
|
|
244
|
+
when 2
|
|
245
|
+
@config.logger.info(text)
|
|
246
|
+
else
|
|
247
|
+
@config.logger.error(text)
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
end
|
|
203
251
|
end
|
|
204
252
|
end
|
|
205
253
|
end
|
|
@@ -57,8 +57,12 @@ module SplitIoClient
|
|
|
57
57
|
end
|
|
58
58
|
without_nil = Array.new
|
|
59
59
|
flag_sets.each { |flag_set|
|
|
60
|
-
|
|
61
|
-
|
|
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)
|
data/splitclient-rb.gemspec
CHANGED
|
@@ -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.
|
|
4
|
+
version: 8.10.0.pre.rc2
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Split Software
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-
|
|
10
|
+
date: 2025-11-05 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
|