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 +4 -4
- data/lib/splitclient-rb/cache/fetchers/segment_fetcher.rb +10 -2
- data/lib/splitclient-rb/cache/fetchers/split_fetcher.rb +2 -2
- data/lib/splitclient-rb/constants.rb +0 -1
- data/lib/splitclient-rb/engine/synchronizer.rb +4 -13
- data/lib/splitclient-rb/sse/event_source/client.rb +5 -0
- data/lib/splitclient-rb/sse/workers/segments_worker.rb +5 -4
- data/lib/splitclient-rb/sse/workers/splits_worker.rb +6 -3
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 287f7f79723676d979a36e981d7aa7872eb10b77
|
4
|
+
data.tar.gz: 963b3062d4197614d6d36e48fb9fdd680c41bc34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
@@ -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
|
-
|
57
|
-
|
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
|
-
|
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
|
@@ -48,12 +48,13 @@ module SplitIoClient
|
|
48
48
|
def perform
|
49
49
|
while (item = @queue.pop)
|
50
50
|
segment_name = item[:segment_name]
|
51
|
-
|
52
|
-
|
51
|
+
cn = item[:change_number]
|
52
|
+
@config.logger.debug("SegmentsWorker change_number dequeue #{segment_name}, #{cn}")
|
53
53
|
|
54
|
-
|
55
|
-
|
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
|
-
|
64
|
+
@config.logger.debug("SplitsWorker change_number dequeue #{change_number}")
|
63
65
|
|
64
|
-
|
65
|
-
|
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
|
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.
|
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-
|
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
|