splitclient-rb 8.10.0.pre.rc5-java → 8.10.0.pre.rc7-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: e33742cc84aa62b21f01506cbea543e297c5ae727c4202099981531f91f5b7f3
4
- data.tar.gz: 1c97b3bb6bc0ad998d6c65898159b1bf1354717fc3cdebc50b66e1dadbcc702f
3
+ metadata.gz: 07bc9672156deaf379729c6ce11c05f384e8891a34d9d2f2ab6043f966240663
4
+ data.tar.gz: ba4f8c9239766472b406a5ac8c3d95389045d2bd74bc415833ea2a4280e67fe3
5
5
  SHA512:
6
- metadata.gz: 951df9f2ed4ced43a484b8fc4275d6e6016c0768aa33071454d147e0d71a2edc241538d355128d2896092608f0348ed94d559d49bc1ba389cca51034ea98da42
7
- data.tar.gz: 68d8c5b96ef83566ff69951f29b13a83d091b7259ed806a9d8b4fb8e0f2096aa4b7ce5870c871b02d511fffbe840b04171ec6ce8d0b195274b8aeeafc24fa4c5
6
+ metadata.gz: f3130f42da606a0ed8f0aeaac6d43300a6bd3bbbd7ca761b479fc2bf0afa26b195ae07ba65453bd569fd3ef3281c42a5faa7af4bad6f7ddda71e96455611b510
7
+ data.tar.gz: 0bc86bb1de4e19ae132ee0a1cbb5a13c099898ac5e18cf447461006b975b27995f9bf005f19c4b2cdabe89e4fb9d17201fd580dc168d69d7b3910bde87d5e127
@@ -38,12 +38,15 @@ module SplitIoClient
38
38
 
39
39
  def close(status = nil)
40
40
  unless connected?
41
- log_if_debug('SSEClient already disconected.', 3)
41
+ @config.logger.debug('SSEClient already disconected.')
42
42
  return
43
43
  end
44
+ @config.logger.debug("Closing SSEClient socket")
44
45
 
45
46
  @connected.make_false
47
+ @socket.sync_close = true if @socket.is_a? OpenSSL::SSL::SSLSocket
46
48
  @socket.close
49
+ @config.logger.debug("SSEClient socket state #{@socket.state}") if @socket.is_a? OpenSSL::SSL::SSLSocket
47
50
  push_status(status)
48
51
  rescue StandardError => e
49
52
  @config.logger.error("SSEClient close Error: #{e.inspect}")
@@ -57,7 +60,6 @@ module SplitIoClient
57
60
 
58
61
  @uri = URI(url)
59
62
  latch = Concurrent::CountDownLatch.new(1)
60
-
61
63
  connect_thread(latch)
62
64
 
63
65
  return false unless latch.wait(CONNECT_TIMEOUT)
@@ -76,56 +78,65 @@ module SplitIoClient
76
78
 
77
79
  def connect_thread(latch)
78
80
  @config.threads[:connect_stream] = Thread.new do
79
- log_if_debug('Starting connect_stream thread ...', 2)
81
+ @config.logger.info('Starting connect_stream thread ...')
80
82
  new_status = connect_stream(latch)
81
83
  push_status(new_status)
82
- log_if_debug('connect_stream thread finished.', 2)
84
+ @config.logger.info('connect_stream thread finished.')
83
85
  end
84
86
  end
85
87
 
86
88
  def connect_stream(latch)
87
89
  return Constants::PUSH_NONRETRYABLE_ERROR unless socket_write(latch)
88
90
  while connected? || @first_event.value
89
- log_if_debug("Inside coonnect_stream while loop.", 3)
90
- if IO.select([@socket], nil, nil, @read_timeout)
91
- begin
92
- partial_data = @socket.readpartial(10_000)
93
- read_first_event(partial_data, latch)
94
-
95
- raise 'eof exception' if partial_data == :eof
96
- rescue IO::WaitReadable => e
97
- log_if_debug("SSE client transient error: #{e.inspect}", 1)
98
- IO.select([@socket], nil, nil, @read_timeout)
99
- retry
100
- rescue Errno::ETIMEDOUT => e
101
- log_if_debug("SSE read operation timed out!: #{e.inspect}", 3)
102
- return Constants::PUSH_RETRYABLE_ERROR
103
- rescue EOFError => e
104
- log_if_debug("SSE read operation EOF Exception!: #{e.inspect}", 3)
105
- raise 'eof exception'
106
- rescue Errno::EAGAIN => e
107
- log_if_debug("SSE client transient error: #{e.inspect}", 1)
108
- IO.select([@socket], nil, nil, @read_timeout)
109
- retry
110
- rescue Errno::EBADF, IOError => e
111
- log_if_debug("SSE read operation EBADF or IOError: #{e.inspect}", 3)
112
- return nil
113
- rescue StandardError => e
114
- log_if_debug("SSE read operation StandardError: #{e.inspect}", 3)
115
- return nil if ENV['SPLITCLIENT_ENV'] == 'test'
116
-
117
- log_if_debug("Error reading partial data: #{e.inspect}", 3)
91
+ begin
92
+ if IO.select([@socket], nil, nil, @read_timeout)
93
+ begin
94
+ partial_data = @socket.readpartial(10_000)
95
+ read_first_event(partial_data, latch)
96
+
97
+ raise 'eof exception' if partial_data == :eof
98
+ rescue IO::WaitReadable => e
99
+ @config.logger.debug("SSE client IO::WaitReadable transient error: #{e.inspect}")
100
+ IO.select([@socket], nil, nil, @read_timeout)
101
+ retry
102
+ rescue Errno::EAGAIN => e
103
+ @config.logger.debug("SSE client transient error: #{e.inspect}")
104
+ IO.select([@socket], nil, nil, @read_timeout)
105
+ retry
106
+ rescue Errno::ETIMEDOUT => e
107
+ @config.logger.error("SSE read operation timed out!: #{e.inspect}")
108
+ return Constants::PUSH_RETRYABLE_ERROR
109
+ rescue EOFError => e
110
+ puts "SSE read operation EOF Exception!: #{e.inspect}"
111
+ @config.logger.error("SSE read operation EOF Exception!: #{e.inspect}")
112
+ raise 'eof exception'
113
+ rescue Errno::EBADF, IOError => e
114
+ @config.logger.error("SSE read operation EBADF or IOError: #{e.inspect}")
115
+ return Constants::PUSH_RETRYABLE_ERROR
116
+ rescue StandardError => e
117
+ @config.logger.error("SSE read operation StandardError: #{e.inspect}")
118
+ return nil if ENV['SPLITCLIENT_ENV'] == 'test'
119
+
120
+ @config.logger.error("Error reading partial data: #{e.inspect}")
121
+ return Constants::PUSH_RETRYABLE_ERROR
122
+ end
123
+ else
124
+ @config.logger.error("SSE read operation timed out, no data available.")
118
125
  return Constants::PUSH_RETRYABLE_ERROR
119
126
  end
120
- else
121
- # Timeout occurred, no data available
122
- log_if_debug("SSE read operation timed out, no data available.", 3)
123
- return Constants::PUSH_RETRYABLE_ERROR
127
+ rescue Errno::EBADF
128
+ @config.logger.debug("SSE socket is not connected (Errno::EBADF)")
129
+ break
130
+ rescue RuntimeError
131
+ raise 'eof exception'
132
+ rescue Exception => e
133
+ @config.logger.debug("SSE socket is not connected: #{e.inspect}")
134
+ break
124
135
  end
125
136
 
126
137
  process_data(partial_data)
127
138
  end
128
- log_if_debug("SSE read operation exited: #{connected?}", 3)
139
+ @config.logger.info("SSE read operation exited: #{connected?}")
129
140
 
130
141
  nil
131
142
  end
@@ -136,7 +147,7 @@ module SplitIoClient
136
147
  @socket.puts(build_request(@uri))
137
148
  true
138
149
  rescue StandardError => e
139
- log_if_debug("Error during connecting to #{@uri.host}. Error: #{e.inspect}", 3)
150
+ @config.logger.error("Error during connecting to #{@uri.host}. Error: #{e.inspect}")
140
151
  latch.count_down
141
152
  false
142
153
  end
@@ -179,9 +190,8 @@ module SplitIoClient
179
190
  IO.select(nil, [ssl_socket])
180
191
  retry
181
192
  end
182
-
183
193
  return ssl_socket
184
- # return ssl_socket.connect
194
+
185
195
  rescue Exception => e
186
196
  @config.logger.error("socket connect error: #{e.inspect}")
187
197
  return nil
@@ -192,7 +202,7 @@ module SplitIoClient
192
202
  end
193
203
 
194
204
  def process_data(partial_data)
195
- log_if_debug("Event partial data: #{partial_data}", 1)
205
+ @config.logger.debug("Event partial data: #{partial_data}")
196
206
  return if partial_data.nil? || partial_data == KEEP_ALIVE_RESPONSE
197
207
 
198
208
  events = @event_parser.parse(partial_data)
@@ -210,7 +220,7 @@ module SplitIoClient
210
220
  req << "SplitSDKMachineName: #{@config.machine_name}\r\n"
211
221
  req << "SplitSDKClientKey: #{@api_key.split(//).last(4).join}\r\n" unless @api_key.nil?
212
222
  req << "Cache-Control: no-cache\r\n\r\n"
213
- log_if_debug("Request info: #{req}", 1)
223
+ @config.logger.debug("Request info: #{req}")
214
224
  req
215
225
  end
216
226
 
@@ -248,19 +258,6 @@ module SplitIoClient
248
258
  @config.logger.debug("Pushing new sse status: #{status}")
249
259
  @status_queue.push(status)
250
260
  end
251
-
252
- def log_if_debug(text, level)
253
- if @config.debug_enabled
254
- case level
255
- when 1
256
- @config.logger.debug(text)
257
- when 2
258
- @config.logger.info(text)
259
- else
260
- @config.logger.error(text)
261
- end
262
- end
263
- end
264
261
  end
265
262
  end
266
263
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '8.10.0-rc5'
2
+ VERSION = '8.10.0-rc7'
3
3
  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.10.0.pre.rc5
4
+ version: 8.10.0.pre.rc7
5
5
  platform: java
6
6
  authors:
7
7
  - Split Software
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-11-07 00:00:00.000000000 Z
10
+ date: 2025-11-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: allocation_stats