splitclient-rb 8.11.1.pre.beta1 → 8.11.1.pre.rc2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b8826705cc51c97b0fd56af17ba520dbc20932c4c658c3e55f0ec04cd9fc850
|
|
4
|
+
data.tar.gz: 3eb1a3e21d490fe80b80f67f73e3372bb822a15607f2231ca3fe335f37cb49ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2abb05c726b7019e7f56240f5b6e69d50689fae3739e714e85c7134ff47fec1bffd54b68bca6c571162a590e87e87ae090376ad7b9854f65373060ddb532bd93
|
|
7
|
+
data.tar.gz: b80cbe9440ec9bf0ff54b057bd95b5c248da1781d1eea157ef9baaa8ff473826c280152e45a2c41b41e8f49dc219733234671984f715b5a7119a37f5dba71b9b
|
|
@@ -16,17 +16,21 @@ module SplitIoClient
|
|
|
16
16
|
response = @auth_api_client.authenticate(@api_key)
|
|
17
17
|
@config.logger.debug("Auth service response push_enabled: #{response[:push_enabled]}") if @config.debug_enabled
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
schedule_next_token_refresh(response[:
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
unless response[:push_enabled]
|
|
20
|
+
schedule_next_token_refresh(@back_off.interval) if response[:retry]
|
|
21
|
+
return false
|
|
22
|
+
end
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
unless @sse_handler.start(response[:token], response[:channels])
|
|
25
|
+
@config.logger.debug('Streaming server returned error') if @config.debug_enabled
|
|
26
|
+
stop_sse
|
|
27
|
+
return false
|
|
25
28
|
end
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
schedule_next_token_refresh(response[:exp])
|
|
31
|
+
@back_off.reset
|
|
32
|
+
record_telemetry(response[:exp])
|
|
33
|
+
true
|
|
30
34
|
rescue StandardError => e
|
|
31
35
|
@config.logger.error("start_sse: #{e.inspect}")
|
|
32
36
|
end
|
|
@@ -10,7 +10,7 @@ module SplitIoClient
|
|
|
10
10
|
module EventSource
|
|
11
11
|
class Client
|
|
12
12
|
DEFAULT_READ_TIMEOUT = 70
|
|
13
|
-
CONNECT_TIMEOUT =
|
|
13
|
+
CONNECT_TIMEOUT = 30
|
|
14
14
|
OK_CODE = 200
|
|
15
15
|
KEEP_ALIVE_RESPONSE = "c\r\n:keepalive\n\n\r\n".freeze
|
|
16
16
|
ERROR_EVENT_TYPE = 'error'.freeze
|
|
@@ -37,17 +37,15 @@ module SplitIoClient
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def close(status = nil)
|
|
40
|
-
|
|
41
|
-
@config.logger.debug('SSEClient already disconected.') if @config.debug_enabled
|
|
42
|
-
return
|
|
43
|
-
end
|
|
44
|
-
@config.logger.debug("Closing SSEClient socket") if @config.debug_enabled
|
|
40
|
+
return if @socket.nil?
|
|
45
41
|
|
|
42
|
+
@config.logger.debug("Closing SSEClient socket") if @config.debug_enabled
|
|
46
43
|
push_status(status)
|
|
47
44
|
@connected.make_false
|
|
48
45
|
@socket.sync_close = true if @socket.is_a? OpenSSL::SSL::SSLSocket
|
|
49
46
|
@socket.close
|
|
50
|
-
@config.logger.debug("SSEClient socket state #{@socket.state}") if @socket.is_a?
|
|
47
|
+
@config.logger.debug("SSEClient socket state #{@socket.state}") if @socket.is_a?(OpenSSL::SSL::SSLSocket) && @config.debug_enabled
|
|
48
|
+
@socket = nil
|
|
51
49
|
rescue StandardError => e
|
|
52
50
|
@config.logger.error("SSEClient close Error: #{e.inspect}")
|
|
53
51
|
end
|
|
@@ -80,7 +78,7 @@ module SplitIoClient
|
|
|
80
78
|
@config.threads[:connect_stream] = Thread.new do
|
|
81
79
|
@config.logger.info('Starting connect_stream thread ...')
|
|
82
80
|
new_status = connect_stream(latch)
|
|
83
|
-
push_status(new_status)
|
|
81
|
+
push_status(new_status) unless new_status.nil?
|
|
84
82
|
@config.logger.info('connect_stream thread finished.')
|
|
85
83
|
end
|
|
86
84
|
end
|
|
@@ -93,8 +91,6 @@ module SplitIoClient
|
|
|
93
91
|
begin
|
|
94
92
|
partial_data = @socket.readpartial(10_000)
|
|
95
93
|
read_first_event(partial_data, latch)
|
|
96
|
-
|
|
97
|
-
raise 'eof exception' if partial_data == :eof
|
|
98
94
|
rescue IO::WaitReadable => e
|
|
99
95
|
@config.logger.debug("SSE client IO::WaitReadable transient error: #{e.inspect}") if @config.debug_enabled
|
|
100
96
|
IO.select([@socket], nil, nil, @read_timeout)
|
|
@@ -107,8 +103,8 @@ module SplitIoClient
|
|
|
107
103
|
@config.logger.error("SSE read operation timed out!: #{e.inspect}")
|
|
108
104
|
return Constants::PUSH_RETRYABLE_ERROR
|
|
109
105
|
rescue EOFError => e
|
|
110
|
-
@config.logger.error("SSE read operation EOF
|
|
111
|
-
|
|
106
|
+
@config.logger.error("SSE read operation EOF, server closed the connection, will reconnect: #{e.inspect}")
|
|
107
|
+
return Constants::PUSH_RETRYABLE_ERROR
|
|
112
108
|
rescue Errno::EBADF, IOError => e
|
|
113
109
|
@config.logger.error("SSE read operation EBADF or IOError: #{e.inspect}")
|
|
114
110
|
return Constants::PUSH_RETRYABLE_ERROR
|
|
@@ -126,8 +122,6 @@ module SplitIoClient
|
|
|
126
122
|
rescue Errno::EBADF
|
|
127
123
|
@config.logger.debug("SSE socket is not connected (Errno::EBADF)") if @config.debug_enabled
|
|
128
124
|
break
|
|
129
|
-
rescue RuntimeError
|
|
130
|
-
raise 'eof exception'
|
|
131
125
|
rescue Exception => e
|
|
132
126
|
@config.logger.debug("SSE socket is not connected: #{e.inspect}") if @config.debug_enabled
|
|
133
127
|
break
|