splitclient-rb 7.2.3.pre.rc1-java → 7.2.3.pre.rc2-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: 82dba9aec3fee3c5432638185912f7a0a99f80e9
4
- data.tar.gz: 3ca561bf1fbc93340182e0c8d7416b811dc6d417
3
+ metadata.gz: 287f7f79723676d979a36e981d7aa7872eb10b77
4
+ data.tar.gz: 963b3062d4197614d6d36e48fb9fdd680c41bc34
5
5
  SHA512:
6
- metadata.gz: 56196cd84b90313f8061dbf0eb4cb96127c084cd363abf7935c98ad090388beafd470b97b50d451cf2c588896ff4433fd9fe2b811b20bf568afc84a40f59fe9b
7
- data.tar.gz: 20a873e2e90614563439d2b3cad835238515bce7b768c9ec27be089e66ad6fe3a5a0704ac9b829289d485a6388afcb7e3cfd597aa96aa07813b2ff2983602c30
6
+ metadata.gz: ee086221eb257722cd337b0c174271c926b249acfe60d96734a8b7da0314439c2cf44ada73df7a08dc19397f5bac8a5cf682dcf814767d343db5ad794793bbfb
7
+ data.tar.gz: 4fdefe428f8d4cfda3577d3fe79a0bc25bab342154b616b99cad81ed19b52e905269abae642f31ba188dbc5958caac002eae3948eb2f4dc5f19449bc46698d79
@@ -27,14 +27,22 @@ module SplitIoClient
27
27
  end
28
28
  end
29
29
 
30
+ def fetch_segments_if_not_exists(names)
31
+ names.each do |name|
32
+ change_number = @segments_repository.get_change_number(name)
33
+
34
+ fetch_segment(name) if change_number == -1
35
+ end
36
+ rescue StandardError => error
37
+ @config.log_found_exception(__method__.to_s, error)
38
+ end
39
+
30
40
  def fetch_segment(name)
31
41
  @semaphore.synchronize do
32
42
  segments_api.fetch_segments_by_names([name])
33
- true
34
43
  end
35
44
  rescue StandardError => error
36
45
  @config.log_found_exception(__method__.to_s, error)
37
- false
38
46
  end
39
47
 
40
48
  def fetch_segments
@@ -41,11 +41,11 @@ module SplitIoClient
41
41
  @config.logger.debug("segments seen(#{data[:segment_names].length}): #{data[:segment_names].to_a}") if @config.debug_enabled
42
42
 
43
43
  @sdk_blocker.splits_ready!
44
- true
44
+
45
+ data[:segment_names]
45
46
  end
46
47
  rescue StandardError => error
47
48
  @config.log_found_exception(__method__.to_s, error)
48
- false
49
49
  end
50
50
 
51
51
  def stop_splits_thread
@@ -13,4 +13,3 @@ class SplitIoClient::Constants
13
13
  PUSH_SUBSYSTEM_READY = 'PUSH_SUBSYSTEM_READY'
14
14
  PUSH_SUBSYSTEM_OFF = 'PUSH_SUBSYSTEM_OFF'
15
15
  end
16
-
@@ -30,7 +30,7 @@ module SplitIoClient
30
30
  def sync_all
31
31
  @config.threads[:sync_all_thread] = Thread.new do
32
32
  @config.logger.debug('Synchronizing Splits and Segments ...') if @config.debug_enabled
33
- fetch_splits
33
+ @split_fetcher.fetch_splits
34
34
  fetch_segments
35
35
  end
36
36
  end
@@ -53,21 +53,12 @@ module SplitIoClient
53
53
  end
54
54
 
55
55
  def fetch_splits
56
- back_off = SplitIoClient::SSE::EventSource::BackOff.new(SplitIoClient::Constants::FETCH_BACK_OFF_BASE_RETRIES, 1)
57
- loop do
58
- break if @split_fetcher.fetch_splits
59
-
60
- sleep(back_off.interval)
61
- end
56
+ segment_names = @split_fetcher.fetch_splits
57
+ @segment_fetcher.fetch_segments_if_not_exists(segment_names) unless segment_names.empty?
62
58
  end
63
59
 
64
60
  def fetch_segment(name)
65
- back_off = SplitIoClient::SSE::EventSource::BackOff.new(SplitIoClient::Constants::FETCH_BACK_OFF_BASE_RETRIES, 1)
66
- loop do
67
- break if @segment_fetcher.fetch_segment(name)
68
-
69
- sleep(back_off.interval)
70
- end
61
+ @segment_fetcher.fetch_segment(name)
71
62
  end
72
63
 
73
64
  private
@@ -43,6 +43,11 @@ module SplitIoClient
43
43
  end
44
44
 
45
45
  def start(url)
46
+ if connected?
47
+ @config.logger.debug('SSEClient already running.')
48
+ return true
49
+ end
50
+
46
51
  @uri = URI(url)
47
52
  latch = Concurrent::CountDownLatch.new(1)
48
53
 
@@ -48,12 +48,13 @@ module SplitIoClient
48
48
  def perform
49
49
  while (item = @queue.pop)
50
50
  segment_name = item[:segment_name]
51
- change_number = item[:change_number]
52
- since = @segments_repository.get_change_number(segment_name)
51
+ cn = item[:change_number]
52
+ @config.logger.debug("SegmentsWorker change_number dequeue #{segment_name}, #{cn}")
53
53
 
54
- unless since >= change_number
55
- @config.logger.debug("SegmentsWorker fetch_segment with #{since}")
54
+ attempt = 0
55
+ while cn > @segments_repository.get_change_number(segment_name).to_i && attempt <= Workers::MAX_RETRIES_ALLOWED
56
56
  @synchronizer.fetch_segment(segment_name)
57
+ attempt += 1
57
58
  end
58
59
  end
59
60
  end
@@ -3,6 +3,8 @@
3
3
  module SplitIoClient
4
4
  module SSE
5
5
  module Workers
6
+ MAX_RETRIES_ALLOWED = 10
7
+
6
8
  class SplitsWorker
7
9
  def initialize(synchronizer, config, splits_repository)
8
10
  @synchronizer = synchronizer
@@ -59,11 +61,12 @@ module SplitIoClient
59
61
 
60
62
  def perform
61
63
  while (change_number = @queue.pop)
62
- since = @splits_repository.get_change_number
64
+ @config.logger.debug("SplitsWorker change_number dequeue #{change_number}")
63
65
 
64
- unless since.to_i >= change_number
65
- @config.logger.debug("SplitsWorker fetch_splits with #{since}")
66
+ attempt = 0
67
+ while change_number > @splits_repository.get_change_number.to_i && attempt <= Workers::MAX_RETRIES_ALLOWED
66
68
  @synchronizer.fetch_splits
69
+ attempt += 1
67
70
  end
68
71
  end
69
72
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '7.2.3.pre.rc1'
2
+ VERSION = '7.2.3.pre.rc2'
3
3
  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: 7.2.3.pre.rc1
4
+ version: 7.2.3.pre.rc2
5
5
  platform: java
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement