unicorn-worker-killer 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/VERSION +1 -1
- data/lib/unicorn/configuration.rb +11 -0
- data/lib/unicorn/worker_killer.rb +17 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a62e19d2cacf4fa0c1156246c9b045b7c9a9910d
|
4
|
+
data.tar.gz: 4c15e610631cac77d7e96221f071f2fb441efcb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d9b47622f9b2f57e5b392b706dd3f2ef9e216bee03a5a5b908c0fc99fcff2963980568cbb36f94ad7d49f7006c5f971dd38fb481b76b8a10eb109c5c3041740
|
7
|
+
data.tar.gz: 1822892d9f269ee1f9c524b1326f972876c5f44e1e6f646189020dcf8ab7ee9406fa02c933dad1930f21e0eb3b175854d9372b633bb2e469bda00b7d7b1cc6f3
|
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
@@ -1,7 +1,10 @@
|
|
1
|
+
require 'unicorn/configuration'
|
2
|
+
|
1
3
|
module Unicorn::WorkerKiller
|
2
4
|
# Self-destruction by sending the signals to myself. The process sometimes
|
3
|
-
# doesn't terminate by
|
5
|
+
# doesn't terminate by SIGQUIT, so this tries to send SIGTERM and SIGKILL
|
4
6
|
# if it doesn't finish immediately.
|
7
|
+
# @see http://unicorn.bogomips.org/SIGNALS.html
|
5
8
|
def self.kill_self(logger, start_time)
|
6
9
|
alive_sec = (Time.now - start_time).to_i
|
7
10
|
|
@@ -9,16 +12,16 @@ module Unicorn::WorkerKiller
|
|
9
12
|
while true
|
10
13
|
i += 1
|
11
14
|
sig = :QUIT
|
12
|
-
if i >
|
15
|
+
if i > configuration.max_quit
|
13
16
|
sig = :TERM
|
14
|
-
elsif i >
|
17
|
+
elsif i > configuration.max_term
|
15
18
|
sig = :KILL
|
16
19
|
end
|
17
20
|
|
18
|
-
logger.warn "#{self} send
|
21
|
+
logger.warn "#{self} send SIG#{sig} (pid: #{Process.pid}) alive: #{alive_sec} sec (trial #{i})"
|
19
22
|
Process.kill sig, Process.pid
|
20
23
|
|
21
|
-
sleep
|
24
|
+
sleep configuration.sleep_interval
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -120,4 +123,13 @@ module Unicorn::WorkerKiller
|
|
120
123
|
end
|
121
124
|
end
|
122
125
|
end
|
126
|
+
|
127
|
+
def self.configure
|
128
|
+
self.configuration ||= Configuration.new
|
129
|
+
yield(configuration) if block_given?
|
130
|
+
end
|
131
|
+
|
132
|
+
class << self
|
133
|
+
attr_accessor :configuration
|
134
|
+
end
|
123
135
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn-worker-killer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuki Ohta
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: unicorn
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
56
|
- VERSION
|
57
|
+
- lib/unicorn/configuration.rb
|
57
58
|
- lib/unicorn/worker_killer.rb
|
58
59
|
- unicorn-worker-killer.gemspec
|
59
60
|
homepage: https://github.com/kzk/unicorn-worker-killer
|