splitclient-rb 7.3.5.pre.rc5 → 8.0.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -7
- data/.rubocop.yml +1 -1
- data/Rakefile +1 -8
- data/lib/splitclient-rb/cache/senders/impressions_adapter/memory_sender.rb +2 -2
- data/lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb +0 -2
- data/lib/splitclient-rb/engine/api/client.rb +0 -23
- data/lib/splitclient-rb/engine/api/telemetry_api.rb +2 -2
- data/lib/splitclient-rb/engine/push_manager.rb +14 -11
- data/lib/splitclient-rb/telemetry/redis/redis_init_producer.rb +1 -1
- data/lib/splitclient-rb/telemetry/sync_task.rb +11 -11
- data/lib/splitclient-rb/version.rb +1 -1
- data/lib/splitclient-rb.rb +0 -1
- data/splitclient-rb.gemspec +3 -5
- metadata +7 -23
- data/Appraisals +0 -10
- data/lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1959ef83640b436c648273ee5971c2a0d9b16af8a3344d9d4b3b544da2bbbe7c
|
4
|
+
data.tar.gz: d37340012997849e1ee3f886696347efd0e6f956051c299f9449b12630a5f193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a7f3ff299c0617afb4a35733a4e50e229ebc8c6036b084efca91bc1e390f7992738ab9ed6a64448dde4d2c4c0a91f11d50dea0eb71a0c785c78b39fc0bd4619
|
7
|
+
data.tar.gz: '08450153e746294a69e3b5e710172a084f1fec246d2b0843e7b16f6da330f1cd0073771deabe8297ec86eea0ae7746faa5d5007a875f29d05862cb6f1d166069'
|
data/.github/workflows/ci.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
require 'rubocop/rake_task'
|
6
|
-
require 'appraisal'
|
7
6
|
|
8
7
|
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
9
8
|
|
@@ -26,10 +25,4 @@ else
|
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
29
|
-
|
30
|
-
task :default do
|
31
|
-
sh 'appraisal install && rake appraisal && rake rubocop'
|
32
|
-
end
|
33
|
-
else
|
34
|
-
task default: %i[spec rubocop]
|
35
|
-
end
|
28
|
+
task default: %i[spec rubocop]
|
@@ -31,9 +31,9 @@ module SplitIoClient
|
|
31
31
|
def uniques_formatter(uniques)
|
32
32
|
return if uniques.nil? || uniques.empty?
|
33
33
|
|
34
|
-
to_return = {
|
34
|
+
to_return = { keys: [] }
|
35
35
|
uniques.each do |key, value|
|
36
|
-
to_return[:
|
36
|
+
to_return[:keys] << {
|
37
37
|
f: key,
|
38
38
|
ks: value.to_a
|
39
39
|
}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'net/http/persistent'
|
4
|
-
|
5
3
|
module SplitIoClient
|
6
4
|
module Api
|
7
5
|
class Client
|
@@ -54,33 +52,12 @@ module SplitIoClient
|
|
54
52
|
private
|
55
53
|
|
56
54
|
def api_client
|
57
|
-
if needs_patched_net_http_persistent_adapter?
|
58
|
-
require 'splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent'
|
59
|
-
|
60
|
-
Faraday::Adapter.register_middleware(
|
61
|
-
net_http_persistent: SplitIoClient::FaradayAdapter::PatchedNetHttpPersistent
|
62
|
-
)
|
63
|
-
end
|
64
|
-
|
65
55
|
@api_client ||= Faraday.new do |builder|
|
66
56
|
builder.use SplitIoClient::FaradayMiddleware::Gzip
|
67
57
|
builder.adapter :net_http_persistent
|
68
58
|
end
|
69
59
|
end
|
70
60
|
|
71
|
-
def needs_patched_net_http_persistent_adapter?
|
72
|
-
new_net_http_persistent? && incompatible_faraday_version?
|
73
|
-
end
|
74
|
-
|
75
|
-
def incompatible_faraday_version?
|
76
|
-
version = Faraday::VERSION.split('.')[0..1]
|
77
|
-
version[0].to_i == 0 && version[1].to_i < 13
|
78
|
-
end
|
79
|
-
|
80
|
-
def new_net_http_persistent?
|
81
|
-
Net::HTTP::Persistent::VERSION.split('.').first.to_i >= 3
|
82
|
-
end
|
83
|
-
|
84
61
|
def common_headers(api_key)
|
85
62
|
{
|
86
63
|
'Authorization' => "Bearer #{api_key}",
|
@@ -18,9 +18,9 @@ module SplitIoClient
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def record_unique_keys(uniques)
|
21
|
-
return if uniques[:
|
21
|
+
return if uniques[:keys].empty?
|
22
22
|
|
23
|
-
post_telemetry("#{@config.telemetry_service_url}/
|
23
|
+
post_telemetry("#{@config.telemetry_service_url}/keys/ss", uniques, 'unique_keys')
|
24
24
|
rescue StandardError => e
|
25
25
|
@config.log_found_exception(__method__.to_s, e)
|
26
26
|
end
|
@@ -41,17 +41,20 @@ module SplitIoClient
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def schedule_next_token_refresh(time)
|
44
|
-
@config.threads[:schedule_next_token_refresh] = Thread.new
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
@config.threads[:schedule_next_token_refresh] = Thread.new { refresh_token_task(time) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def refresh_token_task(time)
|
48
|
+
@config.logger.debug("schedule_next_token_refresh refresh in #{time} seconds.") if @config.debug_enabled
|
49
|
+
|
50
|
+
sleep(time)
|
51
|
+
|
52
|
+
@config.logger.debug('schedule_next_token_refresh starting ...') if @config.debug_enabled
|
53
|
+
@sse_handler.stop
|
54
|
+
|
55
|
+
start_sse
|
56
|
+
rescue StandardError => e
|
57
|
+
@config.logger.debug("schedule_next_token_refresh error: #{e.inspect}") if @config.debug_enabled
|
55
58
|
end
|
56
59
|
|
57
60
|
def record_telemetry(time)
|
@@ -15,21 +15,21 @@ module SplitIoClient
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def stats_thread
|
18
|
-
@config.threads[:telemetry_stats_sender] = Thread.new
|
19
|
-
|
20
|
-
@config.logger.info('Starting Telemetry Sync Task')
|
18
|
+
@config.threads[:telemetry_stats_sender] = Thread.new { telemetry_sync_task }
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
def telemetry_sync_task
|
22
|
+
@config.logger.info('Starting Telemetry Sync Task')
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
rescue SplitIoClient::SDKShutdownException
|
28
|
-
@telemetry_synchronizer.synchronize_stats
|
24
|
+
loop do
|
25
|
+
sleep(@config.telemetry_refresh_rate)
|
29
26
|
|
30
|
-
|
31
|
-
end
|
27
|
+
@telemetry_synchronizer.synchronize_stats
|
32
28
|
end
|
29
|
+
rescue SplitIoClient::SDKShutdownException
|
30
|
+
@telemetry_synchronizer.synchronize_stats
|
31
|
+
|
32
|
+
@config.logger.info('Posting Telemetry due to shutdown')
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/splitclient-rb.rb
CHANGED
@@ -49,7 +49,6 @@ require 'splitclient-rb/validators'
|
|
49
49
|
require 'splitclient-rb/split_factory_registry'
|
50
50
|
|
51
51
|
require 'splitclient-rb/engine/api/faraday_middleware/gzip'
|
52
|
-
require 'splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent'
|
53
52
|
require 'splitclient-rb/engine/api/client'
|
54
53
|
require 'splitclient-rb/engine/api/impressions'
|
55
54
|
require 'splitclient-rb/engine/api/segments'
|
data/splitclient-rb.gemspec
CHANGED
@@ -8,16 +8,15 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'splitclient-rb'
|
9
9
|
spec.version = SplitIoClient::VERSION
|
10
10
|
spec.authors = ['Split Software']
|
11
|
-
spec.email = ['
|
12
|
-
|
11
|
+
spec.email = ['mauro.sanz@split.io']
|
13
12
|
spec.summary = 'Ruby client for split SDK.'
|
14
13
|
spec.description = 'Ruby client for using split SDK.'
|
15
14
|
spec.homepage = 'https://github.com/splitio/ruby-client'
|
16
15
|
spec.license = 'Apache-2.0'
|
17
16
|
|
18
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features|ext)/}) }
|
19
|
-
|
20
18
|
spec.require_paths = ['lib']
|
19
|
+
spec.required_ruby_version = '>= 2.5.0'
|
21
20
|
|
22
21
|
if defined?(JRUBY_VERSION)
|
23
22
|
spec.platform = 'java'
|
@@ -37,7 +36,6 @@ Gem::Specification.new do |spec|
|
|
37
36
|
end
|
38
37
|
|
39
38
|
spec.add_development_dependency 'allocation_stats', '~> 0.1'
|
40
|
-
spec.add_development_dependency 'appraisal', '~> 2.4'
|
41
39
|
spec.add_development_dependency 'bundler', '~> 2.2'
|
42
40
|
spec.add_development_dependency 'pry', '~> 0.14'
|
43
41
|
spec.add_development_dependency 'pry-nav', '~> 1.0'
|
@@ -53,7 +51,7 @@ Gem::Specification.new do |spec|
|
|
53
51
|
|
54
52
|
spec.add_runtime_dependency 'bitarray', '~> 1.3'
|
55
53
|
spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
|
56
|
-
spec.add_runtime_dependency 'faraday', '>=
|
54
|
+
spec.add_runtime_dependency 'faraday', '>= 1.1', '< 2.0'
|
57
55
|
spec.add_runtime_dependency 'json', '>= 1.8', '< 3.0'
|
58
56
|
spec.add_runtime_dependency 'jwt', '>= 1.0.0', '< 3.0'
|
59
57
|
spec.add_runtime_dependency 'lru_redux', '~> 1.1'
|
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:
|
4
|
+
version: 8.0.0.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: allocation_stats
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.1'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: appraisal
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.4'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.4'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,7 +226,7 @@ dependencies:
|
|
240
226
|
requirements:
|
241
227
|
- - ">="
|
242
228
|
- !ruby/object:Gem::Version
|
243
|
-
version: '
|
229
|
+
version: '1.1'
|
244
230
|
- - "<"
|
245
231
|
- !ruby/object:Gem::Version
|
246
232
|
version: '2.0'
|
@@ -250,7 +236,7 @@ dependencies:
|
|
250
236
|
requirements:
|
251
237
|
- - ">="
|
252
238
|
- !ruby/object:Gem::Version
|
253
|
-
version: '
|
239
|
+
version: '1.1'
|
254
240
|
- - "<"
|
255
241
|
- !ruby/object:Gem::Version
|
256
242
|
version: '2.0'
|
@@ -384,7 +370,7 @@ dependencies:
|
|
384
370
|
version: '0.3'
|
385
371
|
description: Ruby client for using split SDK.
|
386
372
|
email:
|
387
|
-
-
|
373
|
+
- mauro.sanz@split.io
|
388
374
|
executables: []
|
389
375
|
extensions:
|
390
376
|
- ext/murmurhash/extconf.rb
|
@@ -396,7 +382,6 @@ files:
|
|
396
382
|
- ".gitignore"
|
397
383
|
- ".rubocop.yml"
|
398
384
|
- ".simplecov"
|
399
|
-
- Appraisals
|
400
385
|
- CHANGES.txt
|
401
386
|
- CONTRIBUTORS-GUIDE.md
|
402
387
|
- Gemfile
|
@@ -451,7 +436,6 @@ files:
|
|
451
436
|
- lib/splitclient-rb/constants.rb
|
452
437
|
- lib/splitclient-rb/engine/api/client.rb
|
453
438
|
- lib/splitclient-rb/engine/api/events.rb
|
454
|
-
- lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb
|
455
439
|
- lib/splitclient-rb/engine/api/faraday_middleware/gzip.rb
|
456
440
|
- lib/splitclient-rb/engine/api/impressions.rb
|
457
441
|
- lib/splitclient-rb/engine/api/segments.rb
|
@@ -554,14 +538,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
554
538
|
requirements:
|
555
539
|
- - ">="
|
556
540
|
- !ruby/object:Gem::Version
|
557
|
-
version:
|
541
|
+
version: 2.5.0
|
558
542
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
559
543
|
requirements:
|
560
544
|
- - ">"
|
561
545
|
- !ruby/object:Gem::Version
|
562
546
|
version: 1.3.1
|
563
547
|
requirements: []
|
564
|
-
rubygems_version: 3.
|
548
|
+
rubygems_version: 3.3.5
|
565
549
|
signing_key:
|
566
550
|
specification_version: 4
|
567
551
|
summary: Ruby client for split SDK.
|
data/Appraisals
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SplitIoClient
|
4
|
-
module FaradayAdapter
|
5
|
-
class PatchedNetHttpPersistent < Faraday::Adapter::NetHttpPersistent
|
6
|
-
##
|
7
|
-
# Borrowed directly from the latest `NetHttpPersistent` adapter implementation.
|
8
|
-
#
|
9
|
-
# https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http_persistent.rb
|
10
|
-
#
|
11
|
-
def net_http_connection(env)
|
12
|
-
@cached_connection ||=
|
13
|
-
if Net::HTTP::Persistent.instance_method(:initialize).parameters.first == [:key, :name]
|
14
|
-
Net::HTTP::Persistent.new(name: 'Faraday')
|
15
|
-
else
|
16
|
-
Net::HTTP::Persistent.new('Faraday')
|
17
|
-
end
|
18
|
-
|
19
|
-
proxy_uri = proxy_uri(env)
|
20
|
-
@cached_connection.proxy = proxy_uri if @cached_connection.proxy_uri != proxy_uri
|
21
|
-
@cached_connection
|
22
|
-
end
|
23
|
-
|
24
|
-
def proxy_uri(env)
|
25
|
-
proxy_uri = nil
|
26
|
-
if (proxy = env[:request][:proxy])
|
27
|
-
proxy_uri = ::URI::HTTP === proxy[:uri] ? proxy[:uri].dup : ::URI.parse(proxy[:uri].to_s)
|
28
|
-
proxy_uri.user = proxy_uri.password = nil
|
29
|
-
# awful patch for net-http-persistent 2.8 not unescaping user/password
|
30
|
-
(
|
31
|
-
class << proxy_uri;
|
32
|
-
self;
|
33
|
-
end).class_eval do
|
34
|
-
define_method(:user) { proxy[:user] }
|
35
|
-
define_method(:password) { proxy[:password] }
|
36
|
-
end if proxy[:user]
|
37
|
-
end
|
38
|
-
proxy_uri
|
39
|
-
end
|
40
|
-
|
41
|
-
def with_net_http_connection(env)
|
42
|
-
yield net_http_connection(env)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|