sponges 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sponges/supervisor.rb +10 -6
- data/lib/sponges/version.rb +1 -1
- metadata +2 -2
data/lib/sponges/supervisor.rb
CHANGED
@@ -14,9 +14,11 @@ module Sponges
|
|
14
14
|
options[:size].times do
|
15
15
|
fork_children
|
16
16
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
Thread.new do
|
18
|
+
trap_signals
|
19
|
+
at_exit do
|
20
|
+
Sponges.logger.info "Supervisor exits."
|
21
|
+
end
|
20
22
|
end
|
21
23
|
Sponges.logger.info "Supervisor started, waiting for messages."
|
22
24
|
sleep
|
@@ -57,7 +59,7 @@ module Sponges
|
|
57
59
|
Sponges.logger.warn "Supervisor decrement child's pool by one."
|
58
60
|
if store.children_pids.first
|
59
61
|
kill_one(store.children_pids.first, :HUP)
|
60
|
-
store.delete_children(children_pids.first)
|
62
|
+
store.delete_children(store.children_pids.first)
|
61
63
|
else
|
62
64
|
Sponges.logger.warn "No more child to kill."
|
63
65
|
end
|
@@ -92,7 +94,9 @@ module Sponges
|
|
92
94
|
|
93
95
|
def kill_them_all(signal)
|
94
96
|
store.children_pids.each do |pid|
|
95
|
-
|
97
|
+
Thread.new do
|
98
|
+
kill_one(pid.to_i, signal)
|
99
|
+
end
|
96
100
|
end
|
97
101
|
end
|
98
102
|
|
@@ -101,7 +105,7 @@ module Sponges
|
|
101
105
|
Process.kill signal, pid
|
102
106
|
Process.waitpid pid
|
103
107
|
Sponges.logger.info "Child #{pid} receive a #{signal} signal."
|
104
|
-
rescue Errno::ESRCH => e
|
108
|
+
rescue Errno::ESRCH, Errno::ECHILD, SignalException => e
|
105
109
|
# Don't panic
|
106
110
|
end
|
107
111
|
end
|
data/lib/sponges/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sponges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: boson
|