splitclient-rb 7.1.0.pre.rc4-java → 7.1.0.pre.rc5-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/lib/splitclient-rb/cache/fetchers/segment_fetcher.rb +6 -2
- data/lib/splitclient-rb/cache/fetchers/split_fetcher.rb +3 -1
- data/lib/splitclient-rb/constants.rb +1 -0
- data/lib/splitclient-rb/engine/auth_api_client.rb +2 -2
- data/lib/splitclient-rb/engine/push_manager.rb +2 -2
- data/lib/splitclient-rb/engine/sync_manager.rb +11 -6
- data/lib/splitclient-rb/engine/synchronizer.rb +13 -3
- data/lib/splitclient-rb/helpers/thread_helper.rb +9 -3
- data/lib/splitclient-rb/sse/event_source/back_off.rb +2 -2
- data/lib/splitclient-rb/sse/event_source/client.rb +14 -7
- data/lib/splitclient-rb/sse/notification_manager_keeper.rb +1 -3
- data/lib/splitclient-rb/sse/notification_processor.rb +3 -3
- data/lib/splitclient-rb/sse/sse_handler.rb +0 -3
- data/lib/splitclient-rb/sse/workers/segments_worker.rb +8 -2
- data/lib/splitclient-rb/sse/workers/splits_worker.rb +9 -2
- data/lib/splitclient-rb/version.rb +1 -1
- data/lib/splitclient-rb.rb +0 -1
- metadata +2 -3
- data/lib/splitclient-rb/sse/workers/control_worker.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c1a2428506b9886365ced5a75c964382e3187c3
|
4
|
+
data.tar.gz: c4b8a9f6b25f71ce404a3bcd8cdb3797d75b4026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 409c8765f7f9cc09cdc0cfd087fb58f67232b033794ef82dd7c517a35893bb654f804e9dd71abaac612b5154f23f4a32b6b79926341a699187acf90e4a56211d
|
7
|
+
data.tar.gz: 570b3fd5c0e0d5d748eb448ae61f6825f3c936ddee5f4de2b1555a318ec85a8888fcf1a30725bcacd9180434cf8dfdaf77e0825221b5610d0f3137674d4c5277
|
data/.rubocop.yml
CHANGED
@@ -15,6 +15,12 @@ Metrics/LineLength:
|
|
15
15
|
Exclude:
|
16
16
|
- spec/sse/**/*
|
17
17
|
- spec/integrations/**/*
|
18
|
+
- spec/engine/sync_manager_spec.rb
|
19
|
+
|
20
|
+
Style/BracesAroundHashParameters:
|
21
|
+
Exclude:
|
22
|
+
- spec/integrations/push_client_spec.rb
|
23
|
+
- spec/engine/synchronizer_spec.rb
|
18
24
|
|
19
25
|
Metrics/BlockLength:
|
20
26
|
Exclude:
|
@@ -28,9 +28,13 @@ module SplitIoClient
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def fetch_segment(name)
|
31
|
-
@semaphore.synchronize
|
31
|
+
@semaphore.synchronize do
|
32
|
+
segments_api.fetch_segments_by_names([name])
|
33
|
+
true
|
34
|
+
end
|
32
35
|
rescue StandardError => error
|
33
36
|
@config.log_found_exception(__method__.to_s, error)
|
37
|
+
false
|
34
38
|
end
|
35
39
|
|
36
40
|
def fetch_segments
|
@@ -51,7 +55,7 @@ module SplitIoClient
|
|
51
55
|
|
52
56
|
def segments_thread
|
53
57
|
@config.threads[:segment_fetcher] = Thread.new do
|
54
|
-
@config.logger.info('Starting segments fetcher service')
|
58
|
+
@config.logger.info('Starting segments fetcher service') if @config.debug_enabled
|
55
59
|
|
56
60
|
loop do
|
57
61
|
next unless @sdk_blocker.splits_repository.ready?
|
@@ -41,9 +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
|
end
|
45
46
|
rescue StandardError => error
|
46
47
|
@config.log_found_exception(__method__.to_s, error)
|
48
|
+
false
|
47
49
|
end
|
48
50
|
|
49
51
|
def stop_splits_thread
|
@@ -54,7 +56,7 @@ module SplitIoClient
|
|
54
56
|
|
55
57
|
def splits_thread
|
56
58
|
@config.threads[:split_fetcher] = Thread.new do
|
57
|
-
@config.logger.info('Starting splits fetcher service')
|
59
|
+
@config.logger.info('Starting splits fetcher service') if @config.debug_enabled
|
58
60
|
loop do
|
59
61
|
fetch_splits
|
60
62
|
|
@@ -41,7 +41,7 @@ module SplitIoClient
|
|
41
41
|
channels_hash = JSON.parse(capability)
|
42
42
|
channels_string = channels_hash.keys.join(',')
|
43
43
|
channels_string = control_channels(channels_string)
|
44
|
-
@config.logger.debug("Channels #{channels_string}")
|
44
|
+
@config.logger.debug("Channels #{channels_string}") if @config.debug_enabled
|
45
45
|
CGI.escape(channels_string)
|
46
46
|
end
|
47
47
|
|
@@ -50,7 +50,7 @@ module SplitIoClient
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def process_success(response)
|
53
|
-
@config.logger.debug("Success connection to: #{@config.auth_service_url}")
|
53
|
+
@config.logger.debug("Success connection to: #{@config.auth_service_url}") if @config.debug_enabled
|
54
54
|
|
55
55
|
body_json = JSON.parse(response.body, symbolize_names: true)
|
56
56
|
push_enabled = body_json[:pushEnabled]
|
@@ -8,13 +8,13 @@ module SplitIoClient
|
|
8
8
|
@sse_handler = sse_handler
|
9
9
|
@auth_api_client = AuthApiClient.new(@config)
|
10
10
|
@api_key = api_key
|
11
|
-
@back_off = SplitIoClient::SSE::EventSource::BackOff.new(@config.auth_retry_back_off_base)
|
11
|
+
@back_off = SplitIoClient::SSE::EventSource::BackOff.new(@config.auth_retry_back_off_base, 1)
|
12
12
|
end
|
13
13
|
|
14
14
|
def start_sse
|
15
15
|
response = @auth_api_client.authenticate(@api_key)
|
16
16
|
|
17
|
-
@config.logger.debug("Auth service response push_enabled: #{response[:push_enabled]}")
|
17
|
+
@config.logger.debug("Auth service response push_enabled: #{response[:push_enabled]}") if @config.debug_enabled
|
18
18
|
if response[:push_enabled]
|
19
19
|
@sse_handler.start(response[:token], response[:channels])
|
20
20
|
schedule_next_token_refresh(response[:exp])
|
@@ -59,7 +59,7 @@ module SplitIoClient
|
|
59
59
|
@synchronizer.start_periodic_fetch
|
60
60
|
@synchronizer.start_periodic_data_recording
|
61
61
|
rescue StandardError => e
|
62
|
-
@config.logger.error(e)
|
62
|
+
@config.logger.error("start_poll error : #{e.inspect}")
|
63
63
|
end
|
64
64
|
|
65
65
|
# Starts thread which fetch splits and segments once and trigger task to periodic data recording.
|
@@ -69,7 +69,7 @@ module SplitIoClient
|
|
69
69
|
@synchronizer.sync_all
|
70
70
|
@synchronizer.start_periodic_data_recording
|
71
71
|
rescue StandardError => e
|
72
|
-
@config.logger.error(e)
|
72
|
+
@config.logger.error("stream_start_thread error : #{e.inspect}")
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -80,7 +80,7 @@ module SplitIoClient
|
|
80
80
|
begin
|
81
81
|
@push_manager.start_sse
|
82
82
|
rescue StandardError => e
|
83
|
-
@config.logger.error(e)
|
83
|
+
@config.logger.error("stream_start_sse_thread error : #{e.inspect}")
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -97,24 +97,29 @@ module SplitIoClient
|
|
97
97
|
@synchronizer.stop_periodic_fetch
|
98
98
|
@synchronizer.sync_all
|
99
99
|
@sse_handler.start_workers
|
100
|
+
rescue StandardError => e
|
101
|
+
@config.logger.error("process_connected error: #{e.inspect}")
|
100
102
|
end
|
101
103
|
|
102
104
|
def process_disconnect
|
103
105
|
@sse_handler.stop_workers
|
104
106
|
@synchronizer.start_periodic_fetch
|
107
|
+
rescue StandardError => e
|
108
|
+
@config.logger.error("process_disconnect error: #{e.inspect}")
|
105
109
|
end
|
106
110
|
|
107
111
|
def process_occupancy(push_enable)
|
108
112
|
process_disconnect unless push_enable
|
109
113
|
process_connected if push_enable
|
114
|
+
rescue StandardError => e
|
115
|
+
@config.logger.error("process_occupancy error: #{e.inspect}")
|
110
116
|
end
|
111
117
|
|
112
118
|
def process_push_shutdown
|
113
|
-
@sse_handler.stop_workers
|
114
119
|
@push_manager.stop_sse
|
115
|
-
|
120
|
+
process_disconnect
|
116
121
|
rescue StandardError => e
|
117
|
-
@config.logger.error(e)
|
122
|
+
@config.logger.error("process_push_shutdown error: #{e.inspect}")
|
118
123
|
end
|
119
124
|
end
|
120
125
|
end
|
@@ -26,7 +26,7 @@ module SplitIoClient
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def sync_all
|
29
|
-
@config.logger.debug('Synchronizing Splits and Segments ...')
|
29
|
+
@config.logger.debug('Synchronizing Splits and Segments ...') if @config.debug_enabled
|
30
30
|
fetch_splits
|
31
31
|
fetch_segments
|
32
32
|
end
|
@@ -48,11 +48,21 @@ module SplitIoClient
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def fetch_splits
|
51
|
-
|
51
|
+
back_off = SplitIoClient::SSE::EventSource::BackOff.new(SplitIoClient::Constants::FETCH_BACK_OFF_BASE_RETRIES, 1)
|
52
|
+
loop do
|
53
|
+
break if @split_fetcher.fetch_splits
|
54
|
+
|
55
|
+
sleep(back_off.interval)
|
56
|
+
end
|
52
57
|
end
|
53
58
|
|
54
59
|
def fetch_segment(name)
|
55
|
-
|
60
|
+
back_off = SplitIoClient::SSE::EventSource::BackOff.new(SplitIoClient::Constants::FETCH_BACK_OFF_BASE_RETRIES, 1)
|
61
|
+
loop do
|
62
|
+
break if @segment_fetcher.fetch_segment(name)
|
63
|
+
|
64
|
+
sleep(back_off.interval)
|
65
|
+
end
|
56
66
|
end
|
57
67
|
|
58
68
|
private
|
@@ -7,12 +7,18 @@ module SplitIoClient
|
|
7
7
|
thread = config.threads[thread_sym]
|
8
8
|
|
9
9
|
unless thread.nil?
|
10
|
-
config.logger.debug("Stopping #{thread_sym} ...")
|
10
|
+
config.logger.debug("Stopping #{thread_sym} ...") if config.debug_enabled
|
11
11
|
sleep(0.1) while thread.status == 'run'
|
12
12
|
Thread.kill(thread)
|
13
13
|
end
|
14
|
-
rescue StandardError =>
|
15
|
-
config.logger.error(
|
14
|
+
rescue StandardError => e
|
15
|
+
config.logger.error(e.inspect)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.alive?(thread_sym, config)
|
19
|
+
thread = config.threads[thread_sym]
|
20
|
+
|
21
|
+
thread.nil? ? false : thread.alive?
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
@@ -64,7 +64,7 @@ module SplitIoClient
|
|
64
64
|
interval = @back_off.interval
|
65
65
|
sleep(interval) if interval.positive?
|
66
66
|
|
67
|
-
@config.logger.info("Connecting to #{@uri.host}...")
|
67
|
+
@config.logger.info("Connecting to #{@uri.host}...") if @config.debug_enabled
|
68
68
|
|
69
69
|
socket_write
|
70
70
|
|
@@ -72,7 +72,13 @@ module SplitIoClient
|
|
72
72
|
begin
|
73
73
|
partial_data = @socket.readpartial(2048, timeout: @read_timeout)
|
74
74
|
rescue Socketry::TimeoutError
|
75
|
-
@config.logger.error("Socket read time out in #{@read_timeout} seconds")
|
75
|
+
@config.logger.error("Socket read time out in #{@read_timeout} seconds") if @config.debug_enabled
|
76
|
+
@connected.make_false
|
77
|
+
@socket&.close
|
78
|
+
@socket = nil
|
79
|
+
connect_stream
|
80
|
+
rescue StandardError => e
|
81
|
+
@config.logger.error(e.inspect)
|
76
82
|
close
|
77
83
|
connect_stream
|
78
84
|
end
|
@@ -98,7 +104,7 @@ module SplitIoClient
|
|
98
104
|
|
99
105
|
def process_data(partial_data)
|
100
106
|
unless partial_data.nil? || partial_data == KEEP_ALIVE_RESPONSE
|
101
|
-
@config.logger.debug("Event partial data: #{partial_data}")
|
107
|
+
@config.logger.debug("Event partial data: #{partial_data}") if @config.debug_enabled
|
102
108
|
buffer = read_partial_data(partial_data)
|
103
109
|
events = parse_event(buffer)
|
104
110
|
|
@@ -113,7 +119,7 @@ module SplitIoClient
|
|
113
119
|
req << "Host: #{uri.host}\r\n"
|
114
120
|
req << "Accept: text/event-stream\r\n"
|
115
121
|
req << "Cache-Control: no-cache\r\n\r\n"
|
116
|
-
@config.logger.debug("Request info: #{req}")
|
122
|
+
@config.logger.debug("Request info: #{req}") if @config.debug_enabled
|
117
123
|
req
|
118
124
|
end
|
119
125
|
|
@@ -142,6 +148,7 @@ module SplitIoClient
|
|
142
148
|
|
143
149
|
events
|
144
150
|
rescue StandardError => e
|
151
|
+
@config.logger.debug(buffer)
|
145
152
|
@config.logger.error("Error during parsing a event: #{e.inspect}")
|
146
153
|
[]
|
147
154
|
end
|
@@ -160,7 +167,7 @@ module SplitIoClient
|
|
160
167
|
events.each do |event|
|
161
168
|
raise SSEClientException.new(event), 'Error event' if event.event_type == 'error'
|
162
169
|
|
163
|
-
@config.logger.debug("Dispatching event: #{event.event_type}, #{event.channel}")
|
170
|
+
@config.logger.debug("Dispatching event: #{event.event_type}, #{event.channel}") if @config.debug_enabled
|
164
171
|
@on[:event].call(event)
|
165
172
|
end
|
166
173
|
rescue SSEClientException => e
|
@@ -171,12 +178,12 @@ module SplitIoClient
|
|
171
178
|
def dispatch_connected
|
172
179
|
@connected.make_true
|
173
180
|
@back_off.reset
|
174
|
-
@config.logger.debug('Dispatching connected')
|
181
|
+
@config.logger.debug('Dispatching connected') if @config.debug_enabled
|
175
182
|
@on[:connected].call
|
176
183
|
end
|
177
184
|
|
178
185
|
def dispatch_disconnect
|
179
|
-
@config.logger.debug('Dispatching disconnect')
|
186
|
+
@config.logger.debug('Dispatching disconnect') if @config.debug_enabled
|
180
187
|
@on[:disconnect].call
|
181
188
|
end
|
182
189
|
end
|
@@ -47,9 +47,7 @@ module SplitIoClient
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def process_event_occupancy(publishers)
|
50
|
-
@config.logger.debug(
|
51
|
-
"Occupancy process event with #{publishers} publishers and polling on: #{@publisher_available.value}"
|
52
|
-
)
|
50
|
+
@config.logger.debug("Occupancy process event with #{publishers} publishers") if @config.debug_enabled
|
53
51
|
if publishers <= 0 && @publisher_available.value
|
54
52
|
@publisher_available.make_false
|
55
53
|
dispatch_occupancy_event(false)
|
@@ -25,12 +25,12 @@ module SplitIoClient
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def process_split_update(notification)
|
28
|
-
@config.logger.debug("SPLIT UPDATE notification received: #{notification}")
|
28
|
+
@config.logger.debug("SPLIT UPDATE notification received: #{notification}") if @config.debug_enabled
|
29
29
|
@splits_worker.add_to_queue(notification.data['changeNumber'])
|
30
30
|
end
|
31
31
|
|
32
32
|
def process_split_kill(notification)
|
33
|
-
@config.logger.debug("SPLIT KILL notification received: #{notification}")
|
33
|
+
@config.logger.debug("SPLIT KILL notification received: #{notification}") if @config.debug_enabled
|
34
34
|
change_number = notification.data['changeNumber']
|
35
35
|
default_treatment = notification.data['defaultTreatment']
|
36
36
|
split_name = notification.data['splitName']
|
@@ -39,7 +39,7 @@ module SplitIoClient
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def process_segment_update(notification)
|
42
|
-
@config.logger.debug("SEGMENT UPDATE notification received: #{notification}")
|
42
|
+
@config.logger.debug("SEGMENT UPDATE notification received: #{notification}") if @config.debug_enabled
|
43
43
|
change_number = notification.data['changeNumber']
|
44
44
|
segment_name = notification.data['segmentName']
|
45
45
|
|
@@ -10,7 +10,6 @@ module SplitIoClient
|
|
10
10
|
@notification_manager_keeper = notification_manager_keeper
|
11
11
|
@splits_worker = SplitIoClient::SSE::Workers::SplitsWorker.new(synchronizer, config, splits_repository)
|
12
12
|
@segments_worker = SplitIoClient::SSE::Workers::SegmentsWorker.new(synchronizer, config, segments_repository)
|
13
|
-
@control_worker = SplitIoClient::SSE::Workers::ControlWorker.new(config)
|
14
13
|
@notification_processor = SplitIoClient::SSE::NotificationProcessor.new(config, @splits_worker, @segments_worker)
|
15
14
|
|
16
15
|
@on = { connected: ->(_) {}, disconnect: ->(_) {} }
|
@@ -40,13 +39,11 @@ module SplitIoClient
|
|
40
39
|
def start_workers
|
41
40
|
@splits_worker.start
|
42
41
|
@segments_worker.start
|
43
|
-
@control_worker.start
|
44
42
|
end
|
45
43
|
|
46
44
|
def stop_workers
|
47
45
|
@splits_worker.stop
|
48
46
|
@segments_worker.stop
|
49
|
-
@control_worker.stop
|
50
47
|
end
|
51
48
|
|
52
49
|
def on_connected(&action)
|
@@ -8,15 +8,20 @@ module SplitIoClient
|
|
8
8
|
@synchronizer = synchronizer
|
9
9
|
@config = config
|
10
10
|
@segments_repository = segments_repository
|
11
|
-
@queue =
|
11
|
+
@queue = nil
|
12
12
|
end
|
13
13
|
|
14
14
|
def start
|
15
|
+
return if SplitIoClient::Helpers::ThreadHelper.alive?(:segment_update_worker, @config)
|
16
|
+
|
17
|
+
@queue = Queue.new
|
15
18
|
perform_thread
|
16
19
|
perform_passenger_forked if defined?(PhusionPassenger)
|
17
20
|
end
|
18
21
|
|
19
22
|
def add_to_queue(change_number, segment_name)
|
23
|
+
return if @queue.nil?
|
24
|
+
|
20
25
|
item = { change_number: change_number, segment_name: segment_name }
|
21
26
|
@config.logger.debug("SegmentsWorker add to queue #{item}")
|
22
27
|
@queue.push(item)
|
@@ -24,6 +29,7 @@ module SplitIoClient
|
|
24
29
|
|
25
30
|
def stop
|
26
31
|
SplitIoClient::Helpers::ThreadHelper.stop(:segment_update_worker, @config)
|
32
|
+
@queue = nil
|
27
33
|
end
|
28
34
|
|
29
35
|
private
|
@@ -43,7 +49,7 @@ module SplitIoClient
|
|
43
49
|
|
44
50
|
def perform_thread
|
45
51
|
@config.threads[:segment_update_worker] = Thread.new do
|
46
|
-
@config.logger.debug('Starting segments worker ...')
|
52
|
+
@config.logger.debug('Starting segments worker ...') if @config.debug_enabled
|
47
53
|
perform
|
48
54
|
end
|
49
55
|
end
|
@@ -8,20 +8,26 @@ module SplitIoClient
|
|
8
8
|
@synchronizer = synchronizer
|
9
9
|
@config = config
|
10
10
|
@splits_repository = splits_repository
|
11
|
-
@queue = Queue.new
|
12
11
|
end
|
13
12
|
|
14
13
|
def start
|
14
|
+
return if SplitIoClient::Helpers::ThreadHelper.alive?(:split_update_worker, @config)
|
15
|
+
|
16
|
+
@queue = Queue.new
|
15
17
|
perform_thread
|
16
18
|
perform_passenger_forked if defined?(PhusionPassenger)
|
17
19
|
end
|
18
20
|
|
19
21
|
def add_to_queue(change_number)
|
22
|
+
return if @queue.nil?
|
23
|
+
|
20
24
|
@config.logger.debug("SplitsWorker add to queue #{change_number}")
|
21
25
|
@queue.push(change_number)
|
22
26
|
end
|
23
27
|
|
24
28
|
def kill_split(change_number, split_name, default_treatment)
|
29
|
+
return if @queue.nil?
|
30
|
+
|
25
31
|
@config.logger.debug("SplitsWorker kill #{split_name}, #{change_number}")
|
26
32
|
@splits_repository.kill(change_number, split_name, default_treatment)
|
27
33
|
add_to_queue(change_number)
|
@@ -29,6 +35,7 @@ module SplitIoClient
|
|
29
35
|
|
30
36
|
def stop
|
31
37
|
SplitIoClient::Helpers::ThreadHelper.stop(:split_update_worker, @config)
|
38
|
+
@queue = nil
|
32
39
|
end
|
33
40
|
|
34
41
|
private
|
@@ -46,7 +53,7 @@ module SplitIoClient
|
|
46
53
|
|
47
54
|
def perform_thread
|
48
55
|
@config.threads[:split_update_worker] = Thread.new do
|
49
|
-
@config.logger.debug('Starting splits worker ...')
|
56
|
+
@config.logger.debug('Starting splits worker ...') if @config.debug_enabled
|
50
57
|
perform
|
51
58
|
end
|
52
59
|
end
|
data/lib/splitclient-rb.rb
CHANGED
@@ -98,7 +98,6 @@ require 'splitclient-rb/sse/event_source/back_off'
|
|
98
98
|
require 'splitclient-rb/sse/event_source/client'
|
99
99
|
require 'splitclient-rb/sse/event_source/event_types'
|
100
100
|
require 'splitclient-rb/sse/event_source/stream_data'
|
101
|
-
require 'splitclient-rb/sse/workers/control_worker'
|
102
101
|
require 'splitclient-rb/sse/workers/segments_worker'
|
103
102
|
require 'splitclient-rb/sse/workers/splits_worker'
|
104
103
|
require 'splitclient-rb/sse/notification_manager_keeper'
|
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.1.0.pre.
|
4
|
+
version: 7.1.0.pre.rc5
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -420,7 +420,6 @@ files:
|
|
420
420
|
- lib/splitclient-rb/sse/notification_manager_keeper.rb
|
421
421
|
- lib/splitclient-rb/sse/notification_processor.rb
|
422
422
|
- lib/splitclient-rb/sse/sse_handler.rb
|
423
|
-
- lib/splitclient-rb/sse/workers/control_worker.rb
|
424
423
|
- lib/splitclient-rb/sse/workers/segments_worker.rb
|
425
424
|
- lib/splitclient-rb/sse/workers/splits_worker.rb
|
426
425
|
- lib/splitclient-rb/utilitites.rb
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SplitIoClient
|
4
|
-
module SSE
|
5
|
-
module Workers
|
6
|
-
class ControlWorker
|
7
|
-
def initialize(config)
|
8
|
-
@config = config
|
9
|
-
end
|
10
|
-
|
11
|
-
def start
|
12
|
-
perform_thread
|
13
|
-
perform_passenger_forked if defined?(PhusionPassenger)
|
14
|
-
end
|
15
|
-
|
16
|
-
def stop
|
17
|
-
SplitIoClient::Helpers::ThreadHelper.stop(:control_worker, @config)
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def perform
|
23
|
-
# TODO: IMPLEMENT THIS METHOD.
|
24
|
-
end
|
25
|
-
|
26
|
-
def perform_thread
|
27
|
-
@config.threads[:control_worker] = Thread.new do
|
28
|
-
@config.logger.debug('Starting control worker ...')
|
29
|
-
perform
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def perform_passenger_forked
|
34
|
-
PhusionPassenger.on_event(:starting_worker_process) { |forked| perform_thread if forked }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|