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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/carnivore/runner.rb +16 -1
- data/lib/carnivore/supervisor.rb +5 -2
- data/lib/carnivore/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: aedba5959fa082d4f04f6bb5165ea378cee944ec
|
4
|
+
data.tar.gz: 7bd2695bd45dc6082ab6e0d0945282bf7ddd63c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80577dc5d1759a53abef37c029a0232a15925194778269c860044ae06c746a25b24042fe5c60cff267e799716c5bc3799f60d22f75070581df7b8d35965e3722
|
7
|
+
data.tar.gz: 46726d66aa89017f074909e25d2ff5ff048c49417252cf23fa9bd4014a512243ae5d84e5184328db3e5ca056b94b856ae2917d84e3c47c212263a7c8a68fb2ce
|
data/CHANGELOG.md
CHANGED
data/lib/carnivore/runner.rb
CHANGED
@@ -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
|
data/lib/carnivore/supervisor.rb
CHANGED
@@ -15,9 +15,9 @@ module Carnivore
|
|
15
15
|
|
16
16
|
# Create a new supervisor
|
17
17
|
#
|
18
|
-
# @return [Array<[
|
18
|
+
# @return [Array<[Zoidberg::Registry, Carnivore::Supervisor]>]
|
19
19
|
def create!
|
20
|
-
s =
|
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
|
|
data/lib/carnivore/version.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo-config
|