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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08a6682acfcd86d8f14ad73419ba14c363fdab486f74fed00ab2600102933a92'
4
- data.tar.gz: 38263b8206e23447673e3008418bb7a4ce127ba14f8d861d748946979584f1e7
3
+ metadata.gz: 1959ef83640b436c648273ee5971c2a0d9b16af8a3344d9d4b3b544da2bbbe7c
4
+ data.tar.gz: d37340012997849e1ee3f886696347efd0e6f956051c299f9449b12630a5f193
5
5
  SHA512:
6
- metadata.gz: 6ca8ca135cced312d33d7cd66d29e17c0177ce2c57b34a2c89c9b453abcde26894572ec040584890d8a7af1033629188a802a4df8c721f666ce4a5efbefaa993
7
- data.tar.gz: bbc878936be9b1e91ea205ee13c25861d74a2cfb2e2b6d1f7d188d0f2a07609e8987dc009e9bc6869914ea667da6198f32742a5d42ded2a075e5e8b169ac119b
6
+ metadata.gz: 9a7f3ff299c0617afb4a35733a4e50e229ebc8c6036b084efca91bc1e390f7992738ab9ed6a64448dde4d2c4c0a91f11d50dea0eb71a0c785c78b39fc0bd4619
7
+ data.tar.gz: '08450153e746294a69e3b5e710172a084f1fec246d2b0843e7b16f6da330f1cd0073771deabe8297ec86eea0ae7746faa5d5007a875f29d05862cb6f1d166069'
@@ -1,10 +1,4 @@
1
- on:
2
- push:
3
- branches:
4
- - do-not-send-impressions
5
- pull_request:
6
- branches:
7
- - do-not-send-impressions
1
+ on: [push, pull_request]
8
2
 
9
3
  jobs:
10
4
  test:
data/.rubocop.yml CHANGED
@@ -52,7 +52,7 @@ Naming/FileName:
52
52
  - splitclient-rb.gemspec
53
53
 
54
54
  AllCops:
55
- TargetRubyVersion: 2.3.6
55
+ TargetRubyVersion: 2.5
56
56
  Exclude:
57
57
  - gemfiles/* # excluded as appraisal generates them with errors
58
58
  - lib/*
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
- if !ENV['APPRAISAL_INITIALIZED']
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 = { mtks: [] }
34
+ to_return = { keys: [] }
35
35
  uniques.each do |key, value|
36
- to_return[:mtks] << {
36
+ to_return[:keys] << {
37
37
  f: key,
38
38
  ks: value.to_a
39
39
  }
@@ -29,8 +29,6 @@ module SplitIoClient
29
29
  impressions_count.each do |key, value|
30
30
  pipeline.hincrby(impressions_count_key, key, value)
31
31
  end
32
-
33
- @future = pipeline.hlen(impressions_count_key)
34
32
  end
35
33
 
36
34
  expire_impressions_count_key(impressions_count, result)
@@ -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[:mtks].empty?
21
+ return if uniques[:keys].empty?
22
22
 
23
- post_telemetry("#{@config.telemetry_service_url}/mtks/ss", uniques, 'mtks')
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 do
45
- begin
46
- @config.logger.debug("schedule_next_token_refresh refresh in #{time} seconds.") if @config.debug_enabled
47
- sleep(time)
48
- @config.logger.debug('schedule_next_token_refresh starting ...') if @config.debug_enabled
49
- @sse_handler.stop
50
- start_sse
51
- rescue StandardError => e
52
- @config.logger.debug("schedule_next_token_refresh error: #{e.inspect}") if @config.debug_enabled
53
- end
54
- end
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)
@@ -30,7 +30,7 @@ module SplitIoClient
30
30
  private
31
31
 
32
32
  def config_key
33
- "#{@config.redis_namespace}.telemetry.config"
33
+ "#{@config.redis_namespace}.telemetry.init"
34
34
  end
35
35
  end
36
36
  end
@@ -15,21 +15,21 @@ module SplitIoClient
15
15
  private
16
16
 
17
17
  def stats_thread
18
- @config.threads[:telemetry_stats_sender] = Thread.new do
19
- begin
20
- @config.logger.info('Starting Telemetry Sync Task')
18
+ @config.threads[:telemetry_stats_sender] = Thread.new { telemetry_sync_task }
19
+ end
21
20
 
22
- loop do
23
- sleep(@config.telemetry_refresh_rate)
21
+ def telemetry_sync_task
22
+ @config.logger.info('Starting Telemetry Sync Task')
24
23
 
25
- @telemetry_synchronizer.synchronize_stats
26
- end
27
- rescue SplitIoClient::SDKShutdownException
28
- @telemetry_synchronizer.synchronize_stats
24
+ loop do
25
+ sleep(@config.telemetry_refresh_rate)
29
26
 
30
- @config.logger.info('Posting Telemetry due to shutdown')
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
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '7.3.5.pre.rc5'
2
+ VERSION = '8.0.0.pre.rc1'
3
3
  end
@@ -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'
@@ -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 = ['pato@split.io']
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', '>= 0.8', '< 2.0'
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: 7.3.5.pre.rc5
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-04-20 00:00:00.000000000 Z
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: '0.8'
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: '0.8'
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
- - pato@split.io
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: '0'
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.2.32
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,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- appraise 'faraday-before-0.13' do
4
- gem 'faraday', '>= 0.9', '< 0.13'
5
- gem 'net-http-persistent', '~> 3.0'
6
- end
7
-
8
- appraise 'faraday-after-0.13' do
9
- gem 'faraday', '> 0.13'
10
- end
@@ -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