splitclient-rb 8.1.0.pre.rc1-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: 94b56b28dcd6009d9449f37727d5f1d04f4a7383
4
- data.tar.gz: ece8b59ec6f9a453ce6cdd613e9b7a9d6653ce51
3
+ metadata.gz: 65df520f1b7bf309939a0d76f812232de6301c19
4
+ data.tar.gz: af088bd08046f2296332024e2d103f1c441aa70f
5
5
  SHA512:
6
- metadata.gz: eb5efc14d860c845eb3a40d3717b2abfa138f2a1cd9163c6bb91e27fdfdb03cd4435957a2740d2941f836f579d58d119c27da6cce91272207859d17f15560904
7
- data.tar.gz: d449a63d948099d3cafb182cd848da73b1178972aa837721fdfaa03f376d9d1bd34ecedd04973838808edbd580df42bb0d82af83424b4b544cdbe73bd179b43e
6
+ metadata.gz: b82cefc43c9bf6723deae28fc239f7202dd2624e40186f177e59063df0a633087ec2f22c0866676bd538e155e2dc4e1c616c62d6c6fd19c10d47e0d6ca47e50b
7
+ data.tar.gz: 5d335864f28a51d7a53bdca2b06547888cf56ab8a5846771d02b2906c1522f27077602da70164c8feb76605cb65933ad0d21c6309acf581460461198d1f10798
data/CHANGES.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  CHANGES
2
2
 
3
- 8.1.0 (Oct 3, 2022)
3
+ 8.1.0 (Oct 5, 2022)
4
4
  - Added a new impressions mode for the SDK called NONE , to be used in factory when there is no desire to capture impressions on an SDK factory to feed Split's analytics engine. Running NONE mode, the SDK will only capture unique keys evaluated for a particular feature flag instead of full blown impressions.
5
5
 
6
6
  8.0.1 (Jul 20, 2022)
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
@@ -311,31 +311,17 @@ module SplitIoClient
311
311
  end
312
312
 
313
313
  def init_impressions_mode(impressions_mode, adapter)
314
- if adapter == :redis
315
- impressions_mode ||= :debug
316
-
317
- case impressions_mode
318
- when :optimized
319
- return :optimized
320
- when :none
321
- return :none
322
- else
323
- @logger.error('You passed an invalid impressions_mode, impressions_mode should be one of the following values: :debug or :optimized. Defaulting to :optimized mode') unless impressions_mode == :optimized
324
- return :debug
325
- end
326
- end
327
-
328
- return :debug if adapter == :redis
329
-
330
- impressions_mode ||= :optimized
331
314
  case impressions_mode
332
- when :debug
333
- return :debug
315
+ when :optimized
316
+ return :optimized
334
317
  when :none
335
318
  return :none
319
+ when :debug
320
+ return :debug
336
321
  else
337
- @logger.error('You passed an invalid impressions_mode, impressions_mode should be one of the following values: :debug or :optimized. Defaulting to :optimized mode') unless impressions_mode == :optimized
338
- return :optimized
322
+ default = adapter == :redis ? :debug : :optimized
323
+ @logger.error("You passed an invalid impressions_mode, impressions_mode should be one of the following values: :debug, :optimized or :none. Defaulting to #{default} mode")
324
+ return default
339
325
  end
340
326
  end
341
327
 
@@ -464,7 +450,7 @@ module SplitIoClient
464
450
  end
465
451
 
466
452
  def self.default_features_refresh_rate
467
- 5
453
+ 60
468
454
  end
469
455
 
470
456
  def self.default_segments_refresh_rate
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '8.1.0.pre.rc1'
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.pre.rc1
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-04 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: