radiator 0.3.11 → 0.3.12

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: ad2c2c627c82f4b7a77eba148cb884e274c704a6
4
- data.tar.gz: '0308a2266cbf4a54ef069d66ce22579aedba05ef'
3
+ metadata.gz: 5c1c1462b5782d4dbdc1611cb6e3fa2977041aa2
4
+ data.tar.gz: '068894ae4633baddca507d426a8c9d0069569219'
5
5
  SHA512:
6
- metadata.gz: a6ef349ae2137e72426b98bb2c15528066689250f5b4fa1cd3f2a38da4a2db8c7ec770c2560c6275dfc4d096477d33d4e100c69b2b8a4a290035834f5d45cbc6
7
- data.tar.gz: d84a08d33554048527c224655f91646c61a9a36ef7151071c77ea4b3e5f11eca858e182b283078d274b309317e109b13aa18d122b50eeb0d4e6021da0ad20b8f
6
+ metadata.gz: a88b0789b7181d0ea3190bb31f317a23d11c0b914005b163a456675fad137a533084fafacfdd24fb17f107a203e5ea68486af56d7301fbcd51be4ca1d5f8ab33
7
+ data.tar.gz: f294d130a832f32d5423ccd4d2dff2aee2f71e7e8b44e38c774461d633d5e184fac71351d031496ba653d9cba621d54677741469ecbc26bf565828d7ab2ae903
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- radiator (0.3.11)
4
+ radiator (0.3.12)
5
5
  awesome_print (~> 1.7, >= 1.7.0)
6
6
  bitcoin-ruby (~> 0.0, >= 0.0.11)
7
7
  ffi (~> 1.9, >= 1.9.18)
@@ -519,6 +519,22 @@ module Radiator
519
519
 
520
520
  "#<#{self.class.name} [#{properties}]>"
521
521
  end
522
+
523
+ def stopped?
524
+ http_active = if @http_memo.nil?
525
+ false
526
+ else
527
+ @http_memo.values.map do |http|
528
+ if defined?(http.active?)
529
+ http.active?
530
+ else
531
+ false
532
+ end
533
+ end.include?(true)
534
+ end
535
+
536
+ @uri.nil? && @http_id.nil? && !http_active && @api.nil? && @block_api.nil?
537
+ end
522
538
  private
523
539
  def self.methods_json_path
524
540
  @methods_json_path ||= "#{File.dirname(__FILE__)}/methods.json"
@@ -759,7 +775,7 @@ module Radiator
759
775
 
760
776
  @backoff_sleep *= 2
761
777
  sleep @backoff_sleep
762
-
778
+ ensure
763
779
  if !!@backoff_at && Time.now.utc - @backoff_at > 300
764
780
  @backoff_at = nil
765
781
  @backoff_sleep = nil
@@ -47,7 +47,14 @@ module Radiator
47
47
  @expiration ||= nil
48
48
  @immutable_expiration = !!@expiration
49
49
 
50
- options = options.merge(url: @url, chain: @chain)
50
+ options = options.merge(
51
+ url: @url,
52
+ chain: @chain,
53
+ pool_size: 1,
54
+ persist: false,
55
+ reuse_ssl_sessions: false
56
+ )
57
+
51
58
  @api = Api.new(options)
52
59
  @network_broadcast_api = NetworkBroadcastApi.new(options)
53
60
 
@@ -94,6 +101,8 @@ module Radiator
94
101
  else
95
102
  self
96
103
  end
104
+ ensure
105
+ shutdown
97
106
  end
98
107
 
99
108
  def operations
@@ -108,6 +117,11 @@ module Radiator
108
117
  def operations=(operations)
109
118
  @operations = operations
110
119
  end
120
+
121
+ def shutdown
122
+ @api.shutdown if !!@api
123
+ @network_broadcast_api.shutdown if !!@network_broadcast_api
124
+ end
111
125
  private
112
126
  def payload
113
127
  @payload ||= {
@@ -230,13 +244,13 @@ module Radiator
230
244
 
231
245
  def self.finalize(api, network_broadcast_api)
232
246
  proc {
233
- if !!api
247
+ if !!api && !api.stopped?
234
248
  puts "DESTROY: #{api.inspect}" if ENV['LOG'] == 'TRACE'
235
249
  api.shutdown
236
250
  api = nil
237
251
  end
238
252
 
239
- if !!network_broadcast_api
253
+ if !!network_broadcast_api && !network_broadcast_api.stopped?
240
254
  puts "DESTROY: #{network_broadcast_api.inspect}" if ENV['LOG'] == 'TRACE'
241
255
  network_broadcast_api.shutdown
242
256
  network_broadcast_api = nil
@@ -1,4 +1,4 @@
1
1
  module Radiator
2
- VERSION = '0.3.11'
2
+ VERSION = '0.3.12'
3
3
  AGENT_ID = "radiator/#{VERSION}"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-02 00:00:00.000000000 Z
11
+ date: 2017-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler