splitclient-rb 8.11.0.pre.rc1-java → 8.11.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/lib/splitclient-rb/cache/repositories/segments_repository.rb +9 -8
- data/lib/splitclient-rb/clients/split_client.rb +2 -2
- data/lib/splitclient-rb/engine/api/splits.rb +2 -2
- data/lib/splitclient-rb/engine/auth_api_client.rb +7 -3
- data/lib/splitclient-rb/engine/events/events_manager.rb +17 -9
- data/lib/splitclient-rb/engine/models/sdk_internal_event_notification.rb +8 -6
- data/lib/splitclient-rb/engine/sync_manager.rb +10 -6
- data/lib/splitclient-rb/sse/event_source/client.rb +13 -14
- data/lib/splitclient-rb/sse/event_source/event_parser.rb +2 -2
- data/lib/splitclient-rb/sse/notification_manager_keeper.rb +3 -3
- data/lib/splitclient-rb/sse/workers/segments_worker.rb +4 -4
- data/lib/splitclient-rb/sse/workers/splits_worker.rb +9 -5
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a2782e6eb0c794db92a6ce250bc1ba59fc26d6d175890a10ff52bc1e9140988
|
|
4
|
+
data.tar.gz: 5abd2c9f8b6e59771146559bb3b4542a83c8a7ee12bb59da893492c1f89bc22d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29f9bb03ad89ee9c5cdd349cd97110c518bf43e22d2638a515ce7c950f89689139405604d7f17519e57f11e0d804717397f547debe744273ee7322d99f977ddb
|
|
7
|
+
data.tar.gz: 5d85ab2d0146f3de0f2b25df5b111a532db02ac4001a08ec1f747f899bf243e90362d89cfad5cb38c4335ef694ee39e336d9bdda50cee9d31595577b750b875c
|
|
@@ -23,18 +23,19 @@ module SplitIoClient
|
|
|
23
23
|
name = segment[:name]
|
|
24
24
|
|
|
25
25
|
@adapter.initialize_set(segment_data(name)) unless @adapter.exists?(segment_data(name))
|
|
26
|
-
|
|
27
26
|
add_keys(name, segment[:added])
|
|
28
27
|
remove_keys(name, segment[:removed])
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
SplitIoClient::Engine::Models::
|
|
32
|
-
|
|
33
|
-
SplitIoClient::Engine::Models::
|
|
34
|
-
|
|
28
|
+
if segment[:added].length > 0 || segment[:removed].length > 0
|
|
29
|
+
@internal_events_queue.push(
|
|
30
|
+
SplitIoClient::Engine::Models::SdkInternalEventNotification.new(
|
|
31
|
+
SplitIoClient::Engine::Models::SdkInternalEvent::SEGMENTS_UPDATED,
|
|
32
|
+
SplitIoClient::Engine::Models::EventsMetadata.new(
|
|
33
|
+
SplitIoClient::Engine::Models::SdkEventType::SEGMENTS_UPDATE,
|
|
34
|
+
[]
|
|
35
|
+
)
|
|
35
36
|
)
|
|
36
37
|
)
|
|
37
|
-
|
|
38
|
+
end
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def get_segment_keys(name)
|
|
@@ -118,11 +118,11 @@ module SplitIoClient
|
|
|
118
118
|
@config.logger.info('Split client shutdown started...') if @config.debug_enabled
|
|
119
119
|
if !@config.cache_adapter.is_a?(SplitIoClient::Cache::Adapters::RedisAdapter) && @config.impressions_mode != :none &&
|
|
120
120
|
(!@impressions_repository.empty? || !@events_repository.empty?)
|
|
121
|
-
@config.logger.debug("Impressions and/or Events cache is not empty")
|
|
121
|
+
@config.logger.debug("Impressions and/or Events cache is not empty") if @config.debug_enabled
|
|
122
122
|
# Adding small delay to ensure sender threads are fully running
|
|
123
123
|
sleep(0.1)
|
|
124
124
|
if !@config.threads.key?(:impressions_sender) || !@config.threads.key?(:events_sender)
|
|
125
|
-
@config.logger.debug("Periodic data recording thread has not started yet, waiting for service startup.")
|
|
125
|
+
@config.logger.debug("Periodic data recording thread has not started yet, waiting for service startup.") if @config.debug_enabled
|
|
126
126
|
@config.threads[:start_sdk].join(5) if @config.threads.key?(:start_sdk)
|
|
127
127
|
end
|
|
128
128
|
end
|
|
@@ -24,7 +24,7 @@ module SplitIoClient
|
|
|
24
24
|
|
|
25
25
|
if check_last_proxy_check_timestamp
|
|
26
26
|
@spec_version = SplitIoClient::Spec::FeatureFlags::SPEC_VERSION
|
|
27
|
-
@config.logger.debug("Switching to new Feature flag spec #{@spec_version} and fetching.")
|
|
27
|
+
@config.logger.debug("Switching to new Feature flag spec #{@spec_version} and fetching.") if @config.debug_enabled
|
|
28
28
|
@old_spec_since = since
|
|
29
29
|
since = -1
|
|
30
30
|
since_rbs = -1
|
|
@@ -41,7 +41,7 @@ module SplitIoClient
|
|
|
41
41
|
|
|
42
42
|
params[:sets] = @flag_sets_filter.join(",") unless @flag_sets_filter.empty?
|
|
43
43
|
params[:till] = fetch_options[:till] unless fetch_options[:till].nil?
|
|
44
|
-
@config.logger.debug("Fetching from splitChanges with #{params}: ")
|
|
44
|
+
@config.logger.debug("Fetching from splitChanges with #{params}: ") if @config.debug_enabled
|
|
45
45
|
response = get_api("#{@config.base_uri}/splitChanges", @api_key, params, fetch_options[:cache_control_headers])
|
|
46
46
|
if response.status == 414
|
|
47
47
|
@config.logger.error("Error fetching feature flags; the amount of flag sets provided are too big, causing uri length error.")
|
|
@@ -21,10 +21,12 @@ module SplitIoClient
|
|
|
21
21
|
return process_error(response) if response.status >= 400 && response.status < 500
|
|
22
22
|
|
|
23
23
|
@telemetry_runtime_producer.record_sync_error(Telemetry::Domain::Constants::TOKEN_SYNC, response.status.to_i)
|
|
24
|
-
|
|
24
|
+
if @config.debug_enabled
|
|
25
|
+
@config.logger.debug("Error connecting to: #{@config.auth_service_url}. Response status: #{response.status}")
|
|
26
|
+
end
|
|
25
27
|
{ push_enabled: false, retry: true }
|
|
26
28
|
rescue StandardError => e
|
|
27
|
-
@config.logger.debug("AuthApiClient error: #{e.inspect}.")
|
|
29
|
+
@config.logger.debug("AuthApiClient error: #{e.inspect}.") if @config.debug_enabled
|
|
28
30
|
{ push_enabled: false, retry: false }
|
|
29
31
|
end
|
|
30
32
|
|
|
@@ -51,7 +53,9 @@ module SplitIoClient
|
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
def process_error(response)
|
|
54
|
-
|
|
56
|
+
if @config.debug_enabled
|
|
57
|
+
@config.logger.debug("Error connecting to: #{@config.auth_service_url}. Response status: #{response.status}")
|
|
58
|
+
end
|
|
55
59
|
@telemetry_runtime_producer.record_auth_rejections if response.status == 401
|
|
56
60
|
|
|
57
61
|
{ push_enabled: false, retry: false }
|
|
@@ -4,6 +4,8 @@ module SplitIoClient
|
|
|
4
4
|
module Engine
|
|
5
5
|
module Events
|
|
6
6
|
class EventsManager
|
|
7
|
+
include SplitIoClient::Engine::Models
|
|
8
|
+
|
|
7
9
|
def initialize(events_manager_config, events_delivery, config)
|
|
8
10
|
@manager_config = events_manager_config
|
|
9
11
|
@events_delivery = events_delivery
|
|
@@ -18,15 +20,15 @@ module SplitIoClient
|
|
|
18
20
|
|
|
19
21
|
@mutex.synchronize do
|
|
20
22
|
# SDK ready already fired
|
|
21
|
-
if sdk_event ==
|
|
22
|
-
@active_subscriptions[sdk_event] =
|
|
23
|
+
if sdk_event == SdkEvent::SDK_READY && event_already_triggered(sdk_event)
|
|
24
|
+
@active_subscriptions[sdk_event] = EventActiveSubscriptions.new(true, event_handler)
|
|
23
25
|
@config.logger.debug('EventsManager: Firing SDK_READY event for new subscription') if @config.debug_enabled
|
|
24
26
|
fire_sdk_event(sdk_event, nil)
|
|
25
27
|
return
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
@config.logger.debug("EventsManager: Register event: #{sdk_event}") if @config.debug_enabled
|
|
29
|
-
@active_subscriptions[sdk_event] =
|
|
31
|
+
@active_subscriptions[sdk_event] = EventActiveSubscriptions.new(false, event_handler)
|
|
30
32
|
end
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -48,9 +50,9 @@ module SplitIoClient
|
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
# if client is not subscribed to SDK_READY
|
|
51
|
-
if
|
|
53
|
+
if check_if_register_needed(sorted_event)
|
|
52
54
|
@config.logger.debug('EventsManager: Registering SDK_READY event as fired') if @config.debug_enabled
|
|
53
|
-
@active_subscriptions[
|
|
55
|
+
@active_subscriptions[SdkEvent::SDK_READY] = EventActiveSubscriptions.new(true, nil)
|
|
54
56
|
end
|
|
55
57
|
end
|
|
56
58
|
end
|
|
@@ -65,6 +67,12 @@ module SplitIoClient
|
|
|
65
67
|
|
|
66
68
|
private
|
|
67
69
|
|
|
70
|
+
def check_if_register_needed(sorted_event)
|
|
71
|
+
sorted_event == SdkEvent::SDK_READY &&
|
|
72
|
+
get_event_handler(sorted_event).nil? &&
|
|
73
|
+
!@active_subscriptions.include?(sorted_event)
|
|
74
|
+
end
|
|
75
|
+
|
|
68
76
|
def fire_sdk_event(sdk_event, event_metadata)
|
|
69
77
|
@config.logger.debug("EventsManager: Firing Sdk event: #{sdk_event}") if @config.debug_enabled
|
|
70
78
|
@config.threads[:sdk_event_notify] = Thread.new do
|
|
@@ -104,7 +112,7 @@ module SplitIoClient
|
|
|
104
112
|
end
|
|
105
113
|
|
|
106
114
|
def get_sdk_event_if_applicable(sdk_internal_event)
|
|
107
|
-
final_sdk_event =
|
|
115
|
+
final_sdk_event = ValidSdkEvent.new(nil, false)
|
|
108
116
|
|
|
109
117
|
events_to_fire = []
|
|
110
118
|
require_any_sdk_event = check_require_any(sdk_internal_event)
|
|
@@ -112,7 +120,7 @@ module SplitIoClient
|
|
|
112
120
|
if (!event_already_triggered(require_any_sdk_event.sdk_event) &&
|
|
113
121
|
execution_limit(require_any_sdk_event.sdk_event) == 1) ||
|
|
114
122
|
execution_limit(require_any_sdk_event.sdk_event) == -1
|
|
115
|
-
final_sdk_event =
|
|
123
|
+
final_sdk_event = ValidSdkEvent.new(
|
|
116
124
|
require_any_sdk_event.sdk_event,
|
|
117
125
|
check_prerequisites(require_any_sdk_event.sdk_event) &&
|
|
118
126
|
check_suppressed_by(require_any_sdk_event.sdk_event)
|
|
@@ -172,10 +180,10 @@ module SplitIoClient
|
|
|
172
180
|
end
|
|
173
181
|
|
|
174
182
|
def check_require_any(sdk_internal_event)
|
|
175
|
-
valid_sdk_event =
|
|
183
|
+
valid_sdk_event = ValidSdkEvent.new(nil, false)
|
|
176
184
|
@manager_config.require_any.each do |name, val|
|
|
177
185
|
if val.include?(sdk_internal_event)
|
|
178
|
-
valid_sdk_event =
|
|
186
|
+
valid_sdk_event = ValidSdkEvent.new(name, true)
|
|
179
187
|
return valid_sdk_event
|
|
180
188
|
end
|
|
181
189
|
end
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: false
|
|
2
2
|
|
|
3
3
|
module SplitIoClient
|
|
4
|
-
module Engine
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
module Engine
|
|
5
|
+
module Models
|
|
6
|
+
class SdkInternalEventNotification
|
|
7
|
+
attr_reader :internal_event, :metadata
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
def initialize(internal_event, metadata)
|
|
10
|
+
@internal_event = internal_event
|
|
11
|
+
@metadata = metadata
|
|
12
|
+
end
|
|
11
13
|
end
|
|
12
14
|
end
|
|
13
15
|
end
|
|
@@ -47,13 +47,13 @@ module SplitIoClient
|
|
|
47
47
|
connected = false
|
|
48
48
|
|
|
49
49
|
if @config.streaming_enabled
|
|
50
|
-
@config.logger.debug('Starting Streaming mode ...')
|
|
50
|
+
@config.logger.debug('Starting Streaming mode ...') if @config.debug_enabled
|
|
51
51
|
start_push_status_monitor
|
|
52
52
|
connected = @push_manager.start_sse
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
unless connected
|
|
56
|
-
@config.logger.debug('Starting Polling mode ...')
|
|
56
|
+
@config.logger.debug('Starting Polling mode ...') if @config.debug_enabled
|
|
57
57
|
@synchronizer.start_periodic_fetch
|
|
58
58
|
record_telemetry(Telemetry::Domain::Constants::SYNC_MODE, SYNC_MODE_POLLING)
|
|
59
59
|
end
|
|
@@ -92,7 +92,7 @@ module SplitIoClient
|
|
|
92
92
|
|
|
93
93
|
def process_connected
|
|
94
94
|
if @sse_connected.value
|
|
95
|
-
@config.logger.debug('Streaming already connected.')
|
|
95
|
+
@config.logger.debug('Streaming already connected.') if @config.debug_enabled
|
|
96
96
|
return
|
|
97
97
|
end
|
|
98
98
|
|
|
@@ -107,7 +107,7 @@ module SplitIoClient
|
|
|
107
107
|
|
|
108
108
|
def process_forced_stop
|
|
109
109
|
unless @sse_connected.value
|
|
110
|
-
@config.logger.debug('Streaming already disconnected.')
|
|
110
|
+
@config.logger.debug('Streaming already disconnected.') if @config.debug_enabled
|
|
111
111
|
return
|
|
112
112
|
end
|
|
113
113
|
|
|
@@ -120,7 +120,7 @@ module SplitIoClient
|
|
|
120
120
|
|
|
121
121
|
def process_disconnect(reconnect)
|
|
122
122
|
unless @sse_connected.value
|
|
123
|
-
@config.logger.debug('Streaming already disconnected.')
|
|
123
|
+
@config.logger.debug('Streaming already disconnected.') if @config.debug_enabled
|
|
124
124
|
return
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -169,12 +169,16 @@ module SplitIoClient
|
|
|
169
169
|
when Constants::PUSH_SUBSYSTEM_OFF
|
|
170
170
|
process_push_shutdown
|
|
171
171
|
else
|
|
172
|
-
|
|
172
|
+
log_if_debug('Incorrect push status type.')
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
rescue StandardError => e
|
|
176
176
|
@config.logger.error("Push status handler error: #{e.inspect}")
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
|
+
|
|
180
|
+
def log_if_debug(msg)
|
|
181
|
+
@config.logger.debug(msg) if @config.debug_enabled
|
|
182
|
+
end
|
|
179
183
|
end
|
|
180
184
|
end
|
|
@@ -38,23 +38,23 @@ module SplitIoClient
|
|
|
38
38
|
|
|
39
39
|
def close(status = nil)
|
|
40
40
|
unless connected?
|
|
41
|
-
@config.logger.debug('SSEClient already disconected.')
|
|
41
|
+
@config.logger.debug('SSEClient already disconected.') if @config.debug_enabled
|
|
42
42
|
return
|
|
43
43
|
end
|
|
44
|
-
@config.logger.debug("Closing SSEClient socket")
|
|
44
|
+
@config.logger.debug("Closing SSEClient socket") if @config.debug_enabled
|
|
45
45
|
|
|
46
46
|
push_status(status)
|
|
47
47
|
@connected.make_false
|
|
48
48
|
@socket.sync_close = true if @socket.is_a? OpenSSL::SSL::SSLSocket
|
|
49
49
|
@socket.close
|
|
50
|
-
@config.logger.debug("SSEClient socket state #{@socket.state}") if @socket.is_a? OpenSSL::SSL::SSLSocket
|
|
50
|
+
@config.logger.debug("SSEClient socket state #{@socket.state}") if @socket.is_a? OpenSSL::SSL::SSLSocket && @config.debug_enabled
|
|
51
51
|
rescue StandardError => e
|
|
52
52
|
@config.logger.error("SSEClient close Error: #{e.inspect}")
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def start(url)
|
|
56
56
|
if connected?
|
|
57
|
-
@config.logger.debug('SSEClient already running.')
|
|
57
|
+
@config.logger.debug('SSEClient already running.') if @config.debug_enabled
|
|
58
58
|
return true
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -96,18 +96,17 @@ module SplitIoClient
|
|
|
96
96
|
|
|
97
97
|
raise 'eof exception' if partial_data == :eof
|
|
98
98
|
rescue IO::WaitReadable => e
|
|
99
|
-
@config.logger.debug("SSE client IO::WaitReadable transient error: #{e.inspect}")
|
|
99
|
+
@config.logger.debug("SSE client IO::WaitReadable transient error: #{e.inspect}") if @config.debug_enabled
|
|
100
100
|
IO.select([@socket], nil, nil, @read_timeout)
|
|
101
101
|
retry
|
|
102
102
|
rescue Errno::EAGAIN => e
|
|
103
|
-
@config.logger.debug("SSE client transient error: #{e.inspect}")
|
|
103
|
+
@config.logger.debug("SSE client transient error: #{e.inspect}") if @config.debug_enabled
|
|
104
104
|
IO.select([@socket], nil, nil, @read_timeout)
|
|
105
105
|
retry
|
|
106
106
|
rescue Errno::ETIMEDOUT => e
|
|
107
107
|
@config.logger.error("SSE read operation timed out!: #{e.inspect}")
|
|
108
108
|
return Constants::PUSH_RETRYABLE_ERROR
|
|
109
109
|
rescue EOFError => e
|
|
110
|
-
puts "SSE read operation EOF Exception!: #{e.inspect}"
|
|
111
110
|
@config.logger.error("SSE read operation EOF Exception!: #{e.inspect}")
|
|
112
111
|
raise 'eof exception'
|
|
113
112
|
rescue Errno::EBADF, IOError => e
|
|
@@ -125,12 +124,12 @@ module SplitIoClient
|
|
|
125
124
|
return Constants::PUSH_RETRYABLE_ERROR
|
|
126
125
|
end
|
|
127
126
|
rescue Errno::EBADF
|
|
128
|
-
@config.logger.debug("SSE socket is not connected (Errno::EBADF)")
|
|
127
|
+
@config.logger.debug("SSE socket is not connected (Errno::EBADF)") if @config.debug_enabled
|
|
129
128
|
break
|
|
130
129
|
rescue RuntimeError
|
|
131
130
|
raise 'eof exception'
|
|
132
131
|
rescue Exception => e
|
|
133
|
-
@config.logger.debug("SSE socket is not connected: #{e.inspect}")
|
|
132
|
+
@config.logger.debug("SSE socket is not connected: #{e.inspect}") if @config.debug_enabled
|
|
134
133
|
break
|
|
135
134
|
end
|
|
136
135
|
|
|
@@ -156,7 +155,7 @@ module SplitIoClient
|
|
|
156
155
|
return unless @first_event.value
|
|
157
156
|
|
|
158
157
|
response_code = @event_parser.first_event(data)
|
|
159
|
-
@config.logger.debug("SSE client first event code: #{response_code}")
|
|
158
|
+
@config.logger.debug("SSE client first event code: #{response_code}") if @config.debug_enabled
|
|
160
159
|
|
|
161
160
|
error_event = false
|
|
162
161
|
events = @event_parser.parse(data)
|
|
@@ -165,7 +164,7 @@ module SplitIoClient
|
|
|
165
164
|
|
|
166
165
|
if response_code == OK_CODE && !error_event
|
|
167
166
|
@connected.make_true
|
|
168
|
-
@config.logger.debug("SSE client first event Connected is true")
|
|
167
|
+
@config.logger.debug("SSE client first event Connected is true") if @config.debug_enabled
|
|
169
168
|
@telemetry_runtime_producer.record_streaming_event(Telemetry::Domain::Constants::SSE_CONNECTION_ESTABLISHED, nil)
|
|
170
169
|
push_status(Constants::PUSH_CONNECTED)
|
|
171
170
|
end
|
|
@@ -202,7 +201,7 @@ module SplitIoClient
|
|
|
202
201
|
end
|
|
203
202
|
|
|
204
203
|
def process_data(partial_data)
|
|
205
|
-
@config.logger.debug("Event partial data: #{partial_data}")
|
|
204
|
+
@config.logger.debug("Event partial data: #{partial_data}") if @config.debug_enabled
|
|
206
205
|
return if partial_data.nil? || partial_data == KEEP_ALIVE_RESPONSE
|
|
207
206
|
|
|
208
207
|
events = @event_parser.parse(partial_data)
|
|
@@ -220,7 +219,7 @@ module SplitIoClient
|
|
|
220
219
|
req << "SplitSDKMachineName: #{@config.machine_name}\r\n"
|
|
221
220
|
req << "SplitSDKClientKey: #{@api_key.split(//).last(4).join}\r\n" unless @api_key.nil?
|
|
222
221
|
req << "Cache-Control: no-cache\r\n\r\n"
|
|
223
|
-
@config.logger.debug("Request info: #{req}")
|
|
222
|
+
@config.logger.debug("Request info: #{req}") if @config.debug_enabled
|
|
224
223
|
req
|
|
225
224
|
end
|
|
226
225
|
|
|
@@ -255,7 +254,7 @@ module SplitIoClient
|
|
|
255
254
|
def push_status(status)
|
|
256
255
|
return if status.nil?
|
|
257
256
|
|
|
258
|
-
@config.logger.debug("Pushing new sse status: #{status}")
|
|
257
|
+
@config.logger.debug("Pushing new sse status: #{status}") if @config.debug_enabled
|
|
259
258
|
@status_queue.push(status)
|
|
260
259
|
end
|
|
261
260
|
end
|
|
@@ -29,14 +29,14 @@ module SplitIoClient
|
|
|
29
29
|
|
|
30
30
|
events
|
|
31
31
|
rescue StandardError => e
|
|
32
|
-
@config.logger.debug("Error during parsing a event: #{e.inspect}")
|
|
32
|
+
@config.logger.debug("Error during parsing a event: #{e.inspect}") if @config.debug_enabled
|
|
33
33
|
[]
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def first_event(raw_data)
|
|
37
37
|
raw_data.split("\n")[0].split(' ')[1].to_i
|
|
38
38
|
rescue StandardError => e
|
|
39
|
-
@config.logger.
|
|
39
|
+
@config.logger.error("Error parsing first event: #{e.inspect}")
|
|
40
40
|
BAD_REQUEST_CODE
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -42,12 +42,12 @@ module SplitIoClient
|
|
|
42
42
|
@telemetry_runtime_producer.record_streaming_event(Telemetry::Domain::Constants::STREAMING_STATUS, DISABLED)
|
|
43
43
|
push_status(Constants::PUSH_SUBSYSTEM_OFF)
|
|
44
44
|
else
|
|
45
|
-
@config.logger.error("Incorrect event type: #{incoming_notification}")
|
|
45
|
+
@config.logger.error("Incorrect event type: #{incoming_notification}") if @config.debug_enabled
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def process_event_occupancy(channel, publishers)
|
|
50
|
-
@config.logger.debug("Processed occupancy event with #{publishers} publishers. Channel: #{channel}")
|
|
50
|
+
@config.logger.debug("Processed occupancy event with #{publishers} publishers. Channel: #{channel}") if @config.debug_enabled
|
|
51
51
|
|
|
52
52
|
update_publishers(channel, publishers)
|
|
53
53
|
|
|
@@ -76,7 +76,7 @@ module SplitIoClient
|
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def push_status(status)
|
|
79
|
-
@config.logger.debug("Pushing occupancy status: #{status}")
|
|
79
|
+
@config.logger.debug("Pushing occupancy status: #{status}") if @config.debug_enabled
|
|
80
80
|
@status_queue.push(status)
|
|
81
81
|
end
|
|
82
82
|
end
|
|
@@ -14,13 +14,13 @@ module SplitIoClient
|
|
|
14
14
|
|
|
15
15
|
def add_to_queue(change_number, segment_name)
|
|
16
16
|
item = { change_number: change_number, segment_name: segment_name }
|
|
17
|
-
@config.logger.debug("SegmentsWorker add to queue #{item}")
|
|
17
|
+
@config.logger.debug("SegmentsWorker add to queue #{item}") if @config.debug_enabled
|
|
18
18
|
@queue.push(item)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def start
|
|
22
22
|
if @running.value
|
|
23
|
-
@config.logger.debug('segments worker already running.')
|
|
23
|
+
@config.logger.debug('segments worker already running.') if @config.debug_enabled
|
|
24
24
|
return
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -30,7 +30,7 @@ module SplitIoClient
|
|
|
30
30
|
|
|
31
31
|
def stop
|
|
32
32
|
unless @running.value
|
|
33
|
-
@config.logger.debug('segments worker not running.')
|
|
33
|
+
@config.logger.debug('segments worker not running.') if @config.debug_enabled
|
|
34
34
|
return
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -44,7 +44,7 @@ module SplitIoClient
|
|
|
44
44
|
while (item = @queue.pop)
|
|
45
45
|
segment_name = item[:segment_name]
|
|
46
46
|
cn = item[:change_number]
|
|
47
|
-
@config.logger.debug("SegmentsWorker change_number dequeue #{segment_name}, #{cn}")
|
|
47
|
+
@config.logger.debug("SegmentsWorker change_number dequeue #{segment_name}, #{cn}") if @config.debug_enabled
|
|
48
48
|
|
|
49
49
|
@synchronizer.fetch_segment(segment_name, cn)
|
|
50
50
|
end
|
|
@@ -18,7 +18,7 @@ module SplitIoClient
|
|
|
18
18
|
|
|
19
19
|
def start
|
|
20
20
|
if @running.value
|
|
21
|
-
@config.logger.debug('feature_flags_worker already running.')
|
|
21
|
+
@config.logger.debug('feature_flags_worker already running.') if @config.debug_enabled
|
|
22
22
|
return
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ module SplitIoClient
|
|
|
28
28
|
|
|
29
29
|
def stop
|
|
30
30
|
unless @running.value
|
|
31
|
-
@config.logger.debug('feature_flags_worker not running.')
|
|
31
|
+
@config.logger.debug('feature_flags_worker not running.') if @config.debug_enabled
|
|
32
32
|
return
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -37,7 +37,7 @@ module SplitIoClient
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def add_to_queue(notification)
|
|
40
|
-
@config.logger.debug("feature_flags_worker add to queue #{notification.data['changeNumber']}")
|
|
40
|
+
@config.logger.debug("feature_flags_worker add to queue #{notification.data['changeNumber']}") if @config.debug_enabled
|
|
41
41
|
@queue.push(notification)
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -52,7 +52,9 @@ module SplitIoClient
|
|
|
52
52
|
|
|
53
53
|
def perform
|
|
54
54
|
while (notification = @queue.pop)
|
|
55
|
-
@config.
|
|
55
|
+
if @config.debug_enabled
|
|
56
|
+
@config.logger.debug("feature_flags_worker change_number dequeue #{notification.data['changeNumber']}")
|
|
57
|
+
end
|
|
56
58
|
case notification.data['type']
|
|
57
59
|
when SSE::EventSource::EventTypes::SPLIT_UPDATE
|
|
58
60
|
success = update_feature_flag(notification)
|
|
@@ -117,7 +119,9 @@ module SplitIoClient
|
|
|
117
119
|
def kill_feature_flag(notification)
|
|
118
120
|
return if @feature_flags_repository.get_change_number.to_i > notification.data['changeNumber']
|
|
119
121
|
|
|
120
|
-
@config.
|
|
122
|
+
if @config.debug_enabled
|
|
123
|
+
@config.logger.debug("feature_flags_worker kill #{notification.data['splitName']}, #{notification.data['changeNumber']}")
|
|
124
|
+
end
|
|
121
125
|
@feature_flags_repository.kill(notification.data['changeNumber'],
|
|
122
126
|
notification.data['splitName'],
|
|
123
127
|
notification.data['defaultTreatment'])
|
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.11.0.pre.
|
|
4
|
+
version: 8.11.0.pre.rc2
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Split Software
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-03-
|
|
10
|
+
date: 2026-03-11 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: allocation_stats
|