unicorn_horn 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -7,7 +7,7 @@ module UnicornHorn
7
7
  end
8
8
 
9
9
  def start
10
- register :QUIT, :INT, :TERM, :CHLD
10
+ register :QUIT, :INT, :TERM, :CHLD, :HUP
11
11
  AFTER_FORK << proc{ @workers.clear; forget }
12
12
  @workers.each(&:launch!)
13
13
 
@@ -19,6 +19,7 @@ module UnicornHorn
19
19
  @workers.each{ |w| w.wpid or w.launch! }
20
20
  psleep 1
21
21
  when :CHLD; next
22
+ when :HUP; raze(:QUIT, 5);
22
23
  when :QUIT; raze(:QUIT, 60); break
23
24
  when :TERM, :INT; raze(:TERM, 5); break
24
25
  end
@@ -9,7 +9,7 @@ module UnicornHorn
9
9
 
10
10
  def initialize handler
11
11
  @name = handler.respond_to?(:name) ? handler.name : handler.inspect
12
- @handler = handler.respond_to?(:new) ? handler.new : handler
12
+ @handler = handler
13
13
  end
14
14
 
15
15
  def launch!
@@ -23,6 +23,7 @@ module UnicornHorn
23
23
  [:TERM, :INT].each { |sig| trap(sig) { exit!(0) } }
24
24
  alive = @tmp
25
25
  m = 0
26
+ @handler = @handler.new if @handler.respond_to?(:new)
26
27
  logger.info "worker=#{name} ready"
27
28
 
28
29
  # the actual loop
data/lib/unicorn_horn.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'logger'
1
2
  require 'fcntl'
2
3
  require 'configurer'
3
4
  require 'unicorn_horn/utils'
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joe Edelman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-09 00:00:00 -04:00
17
+ date: 2010-09-15 00:00:00 -07:00
18
18
  default_executable: hornrunner
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency