splitclient-rb 8.1.0-java → 8.1.1.pre.rc1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb +5 -22
- data/lib/splitclient-rb/engine/auth_api_client.rb +9 -6
- data/lib/splitclient-rb/engine/back_off.rb +1 -1
- data/lib/splitclient-rb/engine/push_manager.rb +2 -3
- data/lib/splitclient-rb/engine/synchronizer.rb +7 -6
- data/lib/splitclient-rb/version.rb +1 -1
- data/splitclient-rb.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65df520f1b7bf309939a0d76f812232de6301c19
|
4
|
+
data.tar.gz: af088bd08046f2296332024e2d103f1c441aa70f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b82cefc43c9bf6723deae28fc239f7202dd2624e40186f177e59063df0a633087ec2f22c0866676bd538e155e2dc4e1c616c62d6c6fd19c10d47e0d6ca47e50b
|
7
|
+
data.tar.gz: 5d335864f28a51d7a53bdca2b06547888cf56ab8a5846771d02b2906c1522f27077602da70164c8feb76605cb65933ad0d21c6309acf581460461198d1f10798
|
data/LICENSE
CHANGED
@@ -14,12 +14,12 @@ module SplitIoClient
|
|
14
14
|
def record_uniques_key(uniques)
|
15
15
|
return if uniques.nil? || uniques == {}
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
size = @adapter.add_to_queue(unique_keys_key, formatted)
|
21
|
-
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if formatted.size == size
|
17
|
+
size = 0
|
18
|
+
uniques.each do |key, value|
|
19
|
+
size = @adapter.add_to_queue(unique_keys_key, { f: key, ks: value.to_a }.to_json)
|
22
20
|
end
|
21
|
+
|
22
|
+
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if uniques.length == size
|
23
23
|
rescue StandardError => e
|
24
24
|
@config.log_found_exception(__method__.to_s, e)
|
25
25
|
end
|
@@ -54,23 +54,6 @@ module SplitIoClient
|
|
54
54
|
def unique_keys_key
|
55
55
|
"#{@config.redis_namespace}.uniquekeys"
|
56
56
|
end
|
57
|
-
|
58
|
-
def uniques_formatter(uniques)
|
59
|
-
return if uniques.nil? || uniques.empty?
|
60
|
-
|
61
|
-
to_return = []
|
62
|
-
uniques.each do |key, value|
|
63
|
-
to_return << {
|
64
|
-
f: key,
|
65
|
-
k: value.to_a
|
66
|
-
}
|
67
|
-
end
|
68
|
-
|
69
|
-
to_return
|
70
|
-
rescue StandardError => e
|
71
|
-
@config.log_found_exception(__method__.to_s, e)
|
72
|
-
nil
|
73
|
-
end
|
74
57
|
end
|
75
58
|
end
|
76
59
|
end
|
@@ -59,11 +59,7 @@ module SplitIoClient
|
|
59
59
|
|
60
60
|
def process_success(response, start)
|
61
61
|
@config.logger.debug("Success connection to: #{@config.auth_service_url}") if @config.debug_enabled
|
62
|
-
|
63
|
-
bucket = BinarySearchLatencyTracker.get_bucket((Time.now - start) * 1000.0)
|
64
|
-
@telemetry_runtime_producer.record_sync_latency(Telemetry::Domain::Constants::TOKEN_SYNC, bucket)
|
65
|
-
timestamp = (Time.now.to_f * 1000.0).to_i
|
66
|
-
@telemetry_runtime_producer.record_successful_sync(Telemetry::Domain::Constants::TOKEN_SYNC, timestamp)
|
62
|
+
record_telemetry(start)
|
67
63
|
|
68
64
|
body_json = JSON.parse(response.body, symbolize_names: true)
|
69
65
|
push_enabled = body_json[:pushEnabled]
|
@@ -77,7 +73,7 @@ module SplitIoClient
|
|
77
73
|
@telemetry_runtime_producer.record_token_refreshes
|
78
74
|
end
|
79
75
|
|
80
|
-
{ push_enabled: push_enabled, token: token, channels: channels, exp: exp, retry:
|
76
|
+
{ push_enabled: push_enabled, token: token, channels: channels, exp: exp, retry: true }
|
81
77
|
end
|
82
78
|
|
83
79
|
def control_channels(channels_string)
|
@@ -88,6 +84,13 @@ module SplitIoClient
|
|
88
84
|
|
89
85
|
channels_string.gsub(control_sec, "#{prefix}#{control_sec}")
|
90
86
|
end
|
87
|
+
|
88
|
+
def record_telemetry(start)
|
89
|
+
bucket = BinarySearchLatencyTracker.get_bucket((Time.now - start) * 1000.0)
|
90
|
+
@telemetry_runtime_producer.record_sync_latency(Telemetry::Domain::Constants::TOKEN_SYNC, bucket)
|
91
|
+
timestamp = (Time.now.to_f * 1000.0).to_i
|
92
|
+
@telemetry_runtime_producer.record_successful_sync(Telemetry::Domain::Constants::TOKEN_SYNC, timestamp)
|
93
|
+
end
|
91
94
|
end
|
92
95
|
end
|
93
96
|
end
|
@@ -14,7 +14,6 @@ module SplitIoClient
|
|
14
14
|
|
15
15
|
def start_sse
|
16
16
|
response = @auth_api_client.authenticate(@api_key)
|
17
|
-
|
18
17
|
@config.logger.debug("Auth service response push_enabled: #{response[:push_enabled]}") if @config.debug_enabled
|
19
18
|
|
20
19
|
if response[:push_enabled] && @sse_handler.start(response[:token], response[:channels])
|
@@ -26,7 +25,6 @@ module SplitIoClient
|
|
26
25
|
end
|
27
26
|
|
28
27
|
stop_sse
|
29
|
-
|
30
28
|
schedule_next_token_refresh(@back_off.interval) if response[:retry]
|
31
29
|
false
|
32
30
|
rescue StandardError => e
|
@@ -35,7 +33,8 @@ module SplitIoClient
|
|
35
33
|
|
36
34
|
def stop_sse
|
37
35
|
@sse_handler.stop
|
38
|
-
|
36
|
+
rescue StandardError => e
|
37
|
+
@config.logger.error(e.inspect)
|
39
38
|
end
|
40
39
|
|
41
40
|
private
|
@@ -6,8 +6,6 @@ module SplitIoClient
|
|
6
6
|
include SplitIoClient::Cache::Fetchers
|
7
7
|
include SplitIoClient::Cache::Senders
|
8
8
|
|
9
|
-
ON_DEMAND_FETCH_BACKOFF_BASE_SECONDS = 10
|
10
|
-
ON_DEMAND_FETCH_BACKOFF_MAX_WAIT_SECONDS = 60
|
11
9
|
ON_DEMAND_FETCH_BACKOFF_MAX_RETRIES = 10
|
12
10
|
|
13
11
|
def initialize(
|
@@ -27,6 +25,9 @@ module SplitIoClient
|
|
27
25
|
@telemetry_synchronizer = params[:telemetry_synchronizer]
|
28
26
|
@impressions_sender_adapter = params[:impressions_sender_adapter]
|
29
27
|
@unique_keys_tracker = params[:unique_keys_tracker]
|
28
|
+
|
29
|
+
@splits_sync_backoff = Engine::BackOff.new(10, 0, 60)
|
30
|
+
@segments_sync_backoff = Engine::BackOff.new(10, 0, 60)
|
30
31
|
end
|
31
32
|
|
32
33
|
def sync_all(asynchronous = true)
|
@@ -140,7 +141,7 @@ module SplitIoClient
|
|
140
141
|
|
141
142
|
def attempt_segment_sync(name, target_cn, fetch_options, max_retries, retry_delay_seconds, with_backoff)
|
142
143
|
remaining_attempts = max_retries
|
143
|
-
|
144
|
+
@segments_sync_backoff.reset
|
144
145
|
|
145
146
|
loop do
|
146
147
|
remaining_attempts -= 1
|
@@ -150,14 +151,14 @@ module SplitIoClient
|
|
150
151
|
return sync_result(true, remaining_attempts) if target_cn <= @segments_repository.get_change_number(name).to_i
|
151
152
|
return sync_result(false, remaining_attempts) if remaining_attempts <= 0
|
152
153
|
|
153
|
-
delay = with_backoff ?
|
154
|
+
delay = with_backoff ? @segments_sync_backoff.interval : retry_delay_seconds
|
154
155
|
sleep(delay)
|
155
156
|
end
|
156
157
|
end
|
157
158
|
|
158
159
|
def attempt_splits_sync(target_cn, fetch_options, max_retries, retry_delay_seconds, with_backoff)
|
159
160
|
remaining_attempts = max_retries
|
160
|
-
|
161
|
+
@splits_sync_backoff.reset
|
161
162
|
|
162
163
|
loop do
|
163
164
|
remaining_attempts -= 1
|
@@ -167,7 +168,7 @@ module SplitIoClient
|
|
167
168
|
return sync_result(true, remaining_attempts, result[:segment_names]) if target_cn <= @splits_repository.get_change_number
|
168
169
|
return sync_result(false, remaining_attempts, result[:segment_names]) if remaining_attempts <= 0
|
169
170
|
|
170
|
-
delay = with_backoff ?
|
171
|
+
delay = with_backoff ? @splits_sync_backoff.interval : retry_delay_seconds
|
171
172
|
sleep(delay)
|
172
173
|
end
|
173
174
|
end
|
data/splitclient-rb.gemspec
CHANGED
@@ -57,7 +57,7 @@ Gem::Specification.new do |spec|
|
|
57
57
|
spec.add_runtime_dependency 'jwt', '>= 1.0.0', '< 3.0'
|
58
58
|
spec.add_runtime_dependency 'lru_redux', '~> 1.1'
|
59
59
|
spec.add_runtime_dependency 'net-http-persistent', '>= 2.9', '< 5.0'
|
60
|
-
spec.add_runtime_dependency 'redis', '>= 4.0.0', '<
|
60
|
+
spec.add_runtime_dependency 'redis', '>= 4.0.0', '< 6.0'
|
61
61
|
spec.add_runtime_dependency 'socketry', '>= 0.4', '< 1.0'
|
62
62
|
spec.add_runtime_dependency 'thread_safe', '~> 0.3'
|
63
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.1.
|
4
|
+
version: 8.1.1.pre.rc1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -342,7 +342,7 @@ dependencies:
|
|
342
342
|
version: 4.0.0
|
343
343
|
- - "<"
|
344
344
|
- !ruby/object:Gem::Version
|
345
|
-
version: '
|
345
|
+
version: '6.0'
|
346
346
|
name: redis
|
347
347
|
prerelease: false
|
348
348
|
type: :runtime
|
@@ -353,7 +353,7 @@ dependencies:
|
|
353
353
|
version: 4.0.0
|
354
354
|
- - "<"
|
355
355
|
- !ruby/object:Gem::Version
|
356
|
-
version: '
|
356
|
+
version: '6.0'
|
357
357
|
- !ruby/object:Gem::Dependency
|
358
358
|
requirement: !ruby/object:Gem::Requirement
|
359
359
|
requirements:
|
@@ -556,9 +556,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
556
556
|
version: 2.5.0
|
557
557
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
558
558
|
requirements:
|
559
|
-
- - "
|
559
|
+
- - ">"
|
560
560
|
- !ruby/object:Gem::Version
|
561
|
-
version:
|
561
|
+
version: 1.3.1
|
562
562
|
requirements: []
|
563
563
|
rubyforge_project:
|
564
564
|
rubygems_version: 2.6.14
|