splitclient-rb 8.11.0.pre.rc2 → 8.11.0
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 +1 -0
- data/lib/splitclient-rb/engine/auth_api_client.rb +2 -6
- data/lib/splitclient-rb/engine/events/events_manager.rb +9 -11
- data/lib/splitclient-rb/engine/models/sdk_internal_event_notification.rb +6 -8
- data/lib/splitclient-rb/engine/sync_manager.rb +1 -5
- data/lib/splitclient-rb/sse/workers/splits_worker.rb +2 -6
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 41d269b5dc5e38906001aefe42cb60bb4ef8de5376b9d71c613b5c8345cc9451
|
|
4
|
+
data.tar.gz: 6d66df400c0e2279ac23250dc22540135bd4e358467b5ba17ade47f8efdc6be9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fd4c042221d85b902894870073ec8dda740807f59348c83ce470e5571d929b6e4ca88d19e014c597a91841464a89b4f3c558b35993f091b2d5bc142dc0bfb0e
|
|
7
|
+
data.tar.gz: b1bb37265463a9a8023f70cce31dbc880a2a84c0618b3defc4e0bef9075bb62cc558f68f212e9ea1b4310be51d180a1f5538333b6b30a2e079ce704fd4da638d
|
|
@@ -23,6 +23,7 @@ module SplitIoClient
|
|
|
23
23
|
name = segment[:name]
|
|
24
24
|
|
|
25
25
|
@adapter.initialize_set(segment_data(name)) unless @adapter.exists?(segment_data(name))
|
|
26
|
+
@config.logger.debug(segment)
|
|
26
27
|
add_keys(name, segment[:added])
|
|
27
28
|
remove_keys(name, segment[:removed])
|
|
28
29
|
if segment[:added].length > 0 || segment[:removed].length > 0
|
|
@@ -21,9 +21,7 @@ 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
|
-
if @config.debug_enabled
|
|
25
|
-
@config.logger.debug("Error connecting to: #{@config.auth_service_url}. Response status: #{response.status}")
|
|
26
|
-
end
|
|
24
|
+
@config.logger.debug("Error connecting to: #{@config.auth_service_url}. Response status: #{response.status}") if @config.debug_enabled
|
|
27
25
|
{ push_enabled: false, retry: true }
|
|
28
26
|
rescue StandardError => e
|
|
29
27
|
@config.logger.debug("AuthApiClient error: #{e.inspect}.") if @config.debug_enabled
|
|
@@ -53,9 +51,7 @@ module SplitIoClient
|
|
|
53
51
|
end
|
|
54
52
|
|
|
55
53
|
def process_error(response)
|
|
56
|
-
if @config.debug_enabled
|
|
57
|
-
@config.logger.debug("Error connecting to: #{@config.auth_service_url}. Response status: #{response.status}")
|
|
58
|
-
end
|
|
54
|
+
@config.logger.debug("Error connecting to: #{@config.auth_service_url}. Response status: #{response.status}") if @config.debug_enabled
|
|
59
55
|
@telemetry_runtime_producer.record_auth_rejections if response.status == 401
|
|
60
56
|
|
|
61
57
|
{ push_enabled: false, retry: false }
|
|
@@ -4,8 +4,6 @@ module SplitIoClient
|
|
|
4
4
|
module Engine
|
|
5
5
|
module Events
|
|
6
6
|
class EventsManager
|
|
7
|
-
include SplitIoClient::Engine::Models
|
|
8
|
-
|
|
9
7
|
def initialize(events_manager_config, events_delivery, config)
|
|
10
8
|
@manager_config = events_manager_config
|
|
11
9
|
@events_delivery = events_delivery
|
|
@@ -20,15 +18,15 @@ module SplitIoClient
|
|
|
20
18
|
|
|
21
19
|
@mutex.synchronize do
|
|
22
20
|
# SDK ready already fired
|
|
23
|
-
if sdk_event == SdkEvent::SDK_READY && event_already_triggered(sdk_event)
|
|
24
|
-
@active_subscriptions[sdk_event] = EventActiveSubscriptions.new(true, event_handler)
|
|
21
|
+
if sdk_event == SplitIoClient::Engine::Models::SdkEvent::SDK_READY && event_already_triggered(sdk_event)
|
|
22
|
+
@active_subscriptions[sdk_event] = SplitIoClient::Engine::Models::EventActiveSubscriptions.new(true, event_handler)
|
|
25
23
|
@config.logger.debug('EventsManager: Firing SDK_READY event for new subscription') if @config.debug_enabled
|
|
26
24
|
fire_sdk_event(sdk_event, nil)
|
|
27
25
|
return
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
@config.logger.debug("EventsManager: Register event: #{sdk_event}") if @config.debug_enabled
|
|
31
|
-
@active_subscriptions[sdk_event] = EventActiveSubscriptions.new(false, event_handler)
|
|
29
|
+
@active_subscriptions[sdk_event] = SplitIoClient::Engine::Models::EventActiveSubscriptions.new(false, event_handler)
|
|
32
30
|
end
|
|
33
31
|
end
|
|
34
32
|
|
|
@@ -52,7 +50,7 @@ module SplitIoClient
|
|
|
52
50
|
# if client is not subscribed to SDK_READY
|
|
53
51
|
if check_if_register_needed(sorted_event)
|
|
54
52
|
@config.logger.debug('EventsManager: Registering SDK_READY event as fired') if @config.debug_enabled
|
|
55
|
-
@active_subscriptions[SdkEvent::SDK_READY] = EventActiveSubscriptions.new(true, nil)
|
|
53
|
+
@active_subscriptions[Engine::Models::SdkEvent::SDK_READY] = Engine::Models::EventActiveSubscriptions.new(true, nil)
|
|
56
54
|
end
|
|
57
55
|
end
|
|
58
56
|
end
|
|
@@ -68,7 +66,7 @@ module SplitIoClient
|
|
|
68
66
|
private
|
|
69
67
|
|
|
70
68
|
def check_if_register_needed(sorted_event)
|
|
71
|
-
sorted_event == SdkEvent::SDK_READY &&
|
|
69
|
+
sorted_event == SplitIoClient::Engine::Models::SdkEvent::SDK_READY &&
|
|
72
70
|
get_event_handler(sorted_event).nil? &&
|
|
73
71
|
!@active_subscriptions.include?(sorted_event)
|
|
74
72
|
end
|
|
@@ -112,7 +110,7 @@ module SplitIoClient
|
|
|
112
110
|
end
|
|
113
111
|
|
|
114
112
|
def get_sdk_event_if_applicable(sdk_internal_event)
|
|
115
|
-
final_sdk_event = ValidSdkEvent.new(nil, false)
|
|
113
|
+
final_sdk_event = SplitIoClient::Engine::Models::ValidSdkEvent.new(nil, false)
|
|
116
114
|
|
|
117
115
|
events_to_fire = []
|
|
118
116
|
require_any_sdk_event = check_require_any(sdk_internal_event)
|
|
@@ -120,7 +118,7 @@ module SplitIoClient
|
|
|
120
118
|
if (!event_already_triggered(require_any_sdk_event.sdk_event) &&
|
|
121
119
|
execution_limit(require_any_sdk_event.sdk_event) == 1) ||
|
|
122
120
|
execution_limit(require_any_sdk_event.sdk_event) == -1
|
|
123
|
-
final_sdk_event = ValidSdkEvent.new(
|
|
121
|
+
final_sdk_event = SplitIoClient::Engine::Models::ValidSdkEvent.new(
|
|
124
122
|
require_any_sdk_event.sdk_event,
|
|
125
123
|
check_prerequisites(require_any_sdk_event.sdk_event) &&
|
|
126
124
|
check_suppressed_by(require_any_sdk_event.sdk_event)
|
|
@@ -180,10 +178,10 @@ module SplitIoClient
|
|
|
180
178
|
end
|
|
181
179
|
|
|
182
180
|
def check_require_any(sdk_internal_event)
|
|
183
|
-
valid_sdk_event = ValidSdkEvent.new(nil, false)
|
|
181
|
+
valid_sdk_event = SplitIoClient::Engine::Models::ValidSdkEvent.new(nil, false)
|
|
184
182
|
@manager_config.require_any.each do |name, val|
|
|
185
183
|
if val.include?(sdk_internal_event)
|
|
186
|
-
valid_sdk_event = ValidSdkEvent.new(name, true)
|
|
184
|
+
valid_sdk_event = SplitIoClient::Engine::Models::ValidSdkEvent.new(name, true)
|
|
187
185
|
return valid_sdk_event
|
|
188
186
|
end
|
|
189
187
|
end
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: false
|
|
2
2
|
|
|
3
3
|
module SplitIoClient
|
|
4
|
-
module Engine
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :internal_event, :metadata
|
|
4
|
+
module Engine::Models
|
|
5
|
+
class SdkInternalEventNotification
|
|
6
|
+
attr_reader :internal_event, :metadata
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
end
|
|
8
|
+
def initialize(internal_event, metadata)
|
|
9
|
+
@internal_event = internal_event
|
|
10
|
+
@metadata = metadata
|
|
13
11
|
end
|
|
14
12
|
end
|
|
15
13
|
end
|
|
@@ -169,16 +169,12 @@ module SplitIoClient
|
|
|
169
169
|
when Constants::PUSH_SUBSYSTEM_OFF
|
|
170
170
|
process_push_shutdown
|
|
171
171
|
else
|
|
172
|
-
|
|
172
|
+
@config.logger.debug('Incorrect push status type.') if @config.debug_enabled
|
|
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
|
|
183
179
|
end
|
|
184
180
|
end
|
|
@@ -52,9 +52,7 @@ module SplitIoClient
|
|
|
52
52
|
|
|
53
53
|
def perform
|
|
54
54
|
while (notification = @queue.pop)
|
|
55
|
-
if @config.debug_enabled
|
|
56
|
-
@config.logger.debug("feature_flags_worker change_number dequeue #{notification.data['changeNumber']}")
|
|
57
|
-
end
|
|
55
|
+
@config.logger.debug("feature_flags_worker change_number dequeue #{notification.data['changeNumber']}") if @config.debug_enabled
|
|
58
56
|
case notification.data['type']
|
|
59
57
|
when SSE::EventSource::EventTypes::SPLIT_UPDATE
|
|
60
58
|
success = update_feature_flag(notification)
|
|
@@ -119,9 +117,7 @@ module SplitIoClient
|
|
|
119
117
|
def kill_feature_flag(notification)
|
|
120
118
|
return if @feature_flags_repository.get_change_number.to_i > notification.data['changeNumber']
|
|
121
119
|
|
|
122
|
-
if @config.debug_enabled
|
|
123
|
-
@config.logger.debug("feature_flags_worker kill #{notification.data['splitName']}, #{notification.data['changeNumber']}")
|
|
124
|
-
end
|
|
120
|
+
@config.logger.debug("feature_flags_worker kill #{notification.data['splitName']}, #{notification.data['changeNumber']}") if @config.debug_enabled
|
|
125
121
|
@feature_flags_repository.kill(notification.data['changeNumber'],
|
|
126
122
|
notification.data['splitName'],
|
|
127
123
|
notification.data['defaultTreatment'])
|