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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffc81241db89baa5be678177e9c396b458fa45c1
4
- data.tar.gz: '0049e2aa1fa6e804f53264b8cd77fe6f4567a892'
3
+ metadata.gz: 65df520f1b7bf309939a0d76f812232de6301c19
4
+ data.tar.gz: af088bd08046f2296332024e2d103f1c441aa70f
5
5
  SHA512:
6
- metadata.gz: 262f726d941f05d2deb3804b66ce24f3cb231dbe615bc23181fb70ff58ce4e48ae2776cf7812a98ca00fcedff43b5e4b19ff82de7d63b2d5143f4c1d73523976
7
- data.tar.gz: 544496e2d48c24daf8989558cee739bb48971b14ca9039b2844074c8e0737f5c0714594fc1d819a0b38c35d409c0ba8aa4d21338f5ef218c90dab4eef9f990a5
6
+ metadata.gz: b82cefc43c9bf6723deae28fc239f7202dd2624e40186f177e59063df0a633087ec2f22c0866676bd538e155e2dc4e1c616c62d6c6fd19c10d47e0d6ca47e50b
7
+ data.tar.gz: 5d335864f28a51d7a53bdca2b06547888cf56ab8a5846771d02b2906c1522f27077602da70164c8feb76605cb65933ad0d21c6309acf581460461198d1f10798
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2022 Split Software, Inc.
1
+ Copyright © 2023 Split Software, Inc.
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -14,12 +14,12 @@ module SplitIoClient
14
14
  def record_uniques_key(uniques)
15
15
  return if uniques.nil? || uniques == {}
16
16
 
17
- formatted = uniques_formatter(uniques).to_json
18
-
19
- unless formatted.nil?
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: false }
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SplitIoClient
4
4
  module Engine
5
- BACKOFF_MAX_ALLOWED = 1.8
5
+ BACKOFF_MAX_ALLOWED = 1800
6
6
  class BackOff
7
7
  def initialize(back_off_base, attempt = 0, max_allowed = BACKOFF_MAX_ALLOWED)
8
8
  @attempt = attempt
@@ -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
- SplitIoClient::Helpers::ThreadHelper.stop(:schedule_next_token_refresh, @config)
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
- backoff = Engine::BackOff.new(ON_DEMAND_FETCH_BACKOFF_BASE_SECONDS, 0, ON_DEMAND_FETCH_BACKOFF_MAX_WAIT_SECONDS) if with_backoff
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 ? backoff.interval : retry_delay_seconds
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
- backoff = Engine::BackOff.new(ON_DEMAND_FETCH_BACKOFF_BASE_SECONDS, 0, ON_DEMAND_FETCH_BACKOFF_MAX_WAIT_SECONDS) if with_backoff
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 ? backoff.interval : retry_delay_seconds
171
+ delay = with_backoff ? @splits_sync_backoff.interval : retry_delay_seconds
171
172
  sleep(delay)
172
173
  end
173
174
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '8.1.0'
2
+ VERSION = '8.1.1.pre.rc1'
3
3
  end
@@ -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', '< 5.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.0
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: 2022-10-05 00:00:00.000000000 Z
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: '5.0'
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: '5.0'
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: '0'
561
+ version: 1.3.1
562
562
  requirements: []
563
563
  rubyforge_project:
564
564
  rubygems_version: 2.6.14