splitclient-rb 7.3.3.pre.rc8 → 7.3.3.pre.rc12

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: 3efd7715a8d5b365643b211ee4eeefa06a7134d131d462795346d52d0afd3cab
4
- data.tar.gz: 8891809092d367d14c643c391d7d0a8929b16d0635f77bda89824a85264d7861
3
+ metadata.gz: fdfcb65f76be36d988dd50b7a8451f9c7543928591364c0af418c480eb7d8b9f
4
+ data.tar.gz: 803770d7a886a327b6c3c53b9b071f18bbabebf18c9fa956198b390ef473f50e
5
5
  SHA512:
6
- metadata.gz: 496077c282dc43226cfcff767c07656b2eda1cc3d8c67ff0d9d6a290db8f060e055fc506342161aa48008336f2d0db03507ba61c4255d5c3d9dc49ed13e3152f
7
- data.tar.gz: 1a2209be83d551f92ee3d9f12e2e2288f284f5fa2f21aef4e9a0e49a3c2f86e71c825274a05cf0e0c31ceff9257ee4baa7536f62639464cd4e2186475d41594f
6
+ metadata.gz: 529234623f76a2b3ca5fd1ab9fba37546545c82c6ce9a7d792e264aec7b6eda4464a5804ecac447ce08b46f99b12eb1654fbca10741e1e1f5352dc37fb07cab6
7
+ data.tar.gz: 194fcc2c307d2c3d7844b952a3666d2505f5bac3b87e5d28bed22adc2eec476af8c6318dc175bde0cb9007869884d50375f1743a071fba46d32989e430b5086a
@@ -7,9 +7,8 @@ module SplitIoClient
7
7
  thread = config.threads[thread_sym]
8
8
 
9
9
  unless thread.nil?
10
- config.logger.debug("Stopping #{thread_sym} thread...") if config.debug_enabled
11
- sleep(0.1) while thread.status == 'run'
12
- Thread.kill(thread)
10
+ Thread.kill thread
11
+ config.logger.debug("#{thread_sym} killed.") if config.debug_enabled
13
12
  end
14
13
  rescue StandardError => e
15
14
  config.logger.error(e.inspect)
@@ -36,10 +36,14 @@ module SplitIoClient
36
36
  end
37
37
 
38
38
  def close(action = Constants::PUSH_NONRETRYABLE_ERROR)
39
- dispatch_action(action)
39
+ unless connected?
40
+ @config.logger.error('SSEClient already disconected.') if @config.debug_enabled
41
+ return
42
+ end
43
+
40
44
  @connected.make_false
41
- SplitIoClient::Helpers::ThreadHelper.stop(:connect_stream, @config)
42
45
  @socket&.close
46
+ dispatch_action(action)
43
47
  rescue StandardError => e
44
48
  @config.logger.error("SSEClient close Error: #{e.inspect}")
45
49
  end
@@ -71,13 +75,17 @@ module SplitIoClient
71
75
 
72
76
  def connect_thread(latch)
73
77
  @config.threads[:connect_stream] = Thread.new do
78
+ @config.logger.error('# CONNECT THREAD')
74
79
  @config.logger.info('Starting connect_stream thread ...') if @config.debug_enabled
75
- connect_stream(latch)
80
+ closed_with_exception = connect_stream(latch)
81
+ close(closed_with_exception) unless closed_with_exception.nil?
82
+ @config.logger.info('connect_stream thread finished.') if @config.debug_enabled
83
+ @config.logger.error('# DISCONNECTED THREAD')
76
84
  end
77
85
  end
78
86
 
79
87
  def connect_stream(latch)
80
- socket_write(latch)
88
+ return Constants::PUSH_NONRETRYABLE_ERROR unless socket_write(latch)
81
89
 
82
90
  while connected? || @first_event.value
83
91
  begin
@@ -86,24 +94,28 @@ module SplitIoClient
86
94
  read_first_event(partial_data, latch)
87
95
 
88
96
  raise 'eof exception' if partial_data == :eof
97
+ rescue Errno::EBADF, IOError => e
98
+ @config.logger.error(e.inspect)
99
+ return nil
89
100
  rescue StandardError => e
90
- @config.logger.error('Error reading partial data: ' + e.inspect) if @config.debug_enabled
91
- close(Constants::PUSH_RETRYABLE_ERROR)
92
- return
101
+ @config.logger.error("Error reading partial data: #{e.inspect}") if @config.debug_enabled
102
+ return Constants::PUSH_RETRYABLE_ERROR
93
103
  end
94
104
 
95
105
  process_data(partial_data)
96
106
  end
107
+ nil
97
108
  end
98
109
 
99
110
  def socket_write(latch)
100
111
  @first_event.make_true
101
112
  @socket = socket_connect
102
113
  @socket.write(build_request(@uri))
114
+ true
103
115
  rescue StandardError => e
104
116
  @config.logger.error("Error during connecting to #{@uri.host}. Error: #{e.inspect}")
105
- close(Constants::PUSH_NONRETRYABLE_ERROR)
106
117
  latch.count_down
118
+ false
107
119
  end
108
120
 
109
121
  def read_first_event(data, latch)
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '7.3.3.pre.rc8'
2
+ VERSION = '7.3.3.pre.rc12'
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.3.3.pre.rc8
4
+ version: 7.3.3.pre.rc12
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-01-20 00:00:00.000000000 Z
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: allocation_stats