carnivore 1.0.4 → 1.0.6

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: 1cc8864e595d0a5dd8fa8b5d530fb6db2a238847
4
- data.tar.gz: c0c182a518b96ec871b3bcc77e25a25fbf4af3a2
3
+ metadata.gz: aedba5959fa082d4f04f6bb5165ea378cee944ec
4
+ data.tar.gz: 7bd2695bd45dc6082ab6e0d0945282bf7ddd63c0
5
5
  SHA512:
6
- metadata.gz: 31f15a9533f22d14ca5c986dc74007bde2cc7fbc39c73cff382ee10e6ad6774d81b2772205c28cea4861e27896a6e2dc0b8ea95fefba41ce07c7757ea1a02f7f
7
- data.tar.gz: 29657c45ce66b925fe0d6ee5da1ba59ba7c1165c04cd38bcaf08a12c00dc20c23a12dad23db0a4d3a0ce5068ec58fc566a41ca4251c03f7a890cca9d7a97fdb6
6
+ metadata.gz: 80577dc5d1759a53abef37c029a0232a15925194778269c860044ae06c746a25b24042fe5c60cff267e799716c5bc3799f60d22f75070581df7b8d35965e3722
7
+ data.tar.gz: 46726d66aa89017f074909e25d2ff5ff048c49417252cf23fa9bd4014a512243ae5d84e5184328db3e5ca056b94b856ae2917d84e3c47c212263a7c8a68fb2ce
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v1.0.6
2
+ * Add forcible shutdown support after timeout
3
+ * Fix supervisor return value to provide subclassed implementation
4
+
1
5
  # v1.0.4
2
6
  * Update async requests to be locked requests
3
7
  * Adjust minimum constraint on zoidberg dependency
@@ -1,6 +1,10 @@
1
1
  require 'carnivore'
2
2
 
3
3
  module Carnivore
4
+
5
+ # Number of seconds to wait for clean shutdown
6
+ FORCE_SHUTDOWN_AFTER = 8
7
+
4
8
  class << self
5
9
 
6
10
  # Sets the global configuration
@@ -96,9 +100,20 @@ module Carnivore
96
100
  rescue Exception => e
97
101
  Carnivore::Logger.warn "Exception type encountered forcing shutdown - #{e.class}: #{e}"
98
102
  Carnivore::Logger.debug "Shutdown exception info: #{e.class}: #{e}\n#{e.backtrace.join("\n")}"
103
+ Zoidberg.signal_shutdown = true
99
104
  supervisor.terminate if supervisor
105
+ Carnivore::Logger.debug 'Carnivore supervisor has been teminated!'
106
+ timeout = Carnivore::FORCE_SHUTDOWN_AFTER
107
+ until(timeout <= 0 || Thread.list.size == 1)
108
+ timeout -= 0.1
109
+ sleep(0.1)
110
+ end
111
+ Thread.list.each do |thread|
112
+ next if Thread.current == thread
113
+ Carnivore::Logger.warn "Force killing live thread for shutdown: #{thread.inspect}"
114
+ thread.kill
115
+ end
100
116
  raise
101
- # Gracefully shut down
102
117
  end
103
118
  end
104
119
  end
@@ -15,9 +15,9 @@ module Carnivore
15
15
 
16
16
  # Create a new supervisor
17
17
  #
18
- # @return [Array<[Celluloid::Registry, Carnivore::Supervisor]>]
18
+ # @return [Array<[Zoidberg::Registry, Carnivore::Supervisor]>]
19
19
  def create!
20
- s = Zoidberg::Supervisor.new
20
+ s = Carnivore::Supervisor.new
21
21
  [s.registry, s]
22
22
  end
23
23
 
@@ -29,6 +29,9 @@ module Carnivore
29
29
  if(sup)
30
30
  @supervisor = sup
31
31
  end
32
+ unless(@supervisor)
33
+ raise Zoidberg::DeadException.new('Instance in terminated state!')
34
+ end
32
35
  @supervisor
33
36
  end
34
37
 
@@ -1,4 +1,4 @@
1
1
  module Carnivore
2
2
  # Current version of library
3
- VERSION = Gem::Version.new('1.0.4')
3
+ VERSION = Gem::Version.new('1.0.6')
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carnivore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2015-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo-config