diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-04-02 22:52:56 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-04-03 02:16:50 -0700 |
commit | 86ba0068f138af96ca7ddd177c0c300b12f513a9 (patch) | |
tree | 240e644086997a956dfe461adcefc0e7b21e67de /lib/unicorn/configurator.rb | |
parent | d964d8966c316fb224e37c3a98345622f3bd0cd7 (diff) | |
download | unicorn-86ba0068f138af96ca7ddd177c0c300b12f513a9.tar.gz |
Premade lambda/proc/Proc objects may all be passed, to the hooks, not just anonymous blocks.
Diffstat (limited to 'lib/unicorn/configurator.rb')
-rw-r--r-- | lib/unicorn/configurator.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb index 2dcad48..150377b 100644 --- a/lib/unicorn/configurator.rb +++ b/lib/unicorn/configurator.rb @@ -105,15 +105,15 @@ module Unicorn # # HUP after QUIT-ing the original master: # server.listen("127.0.0.1:#{9293 + worker_nr}") rescue nil # end - def after_fork(&block) - set_hook(:after_fork, block) + def after_fork(*args, &block) + set_hook(:after_fork, block_given? ? block : args[0]) end # sets before_fork got be a given Proc object. This Proc # object will be called by the master process before forking # each worker. - def before_fork(&block) - set_hook(:before_fork, block) + def before_fork(*args, &block) + set_hook(:before_fork, block_given? ? block : args[0]) end # sets the before_exec hook to a given Proc object. This @@ -122,8 +122,8 @@ module Unicorn # for freeing certain OS resources that you do NOT wish to # share with the reexeced child process. # There is no corresponding after_exec hook (for obvious reasons). - def before_exec(&block) - set_hook(:before_exec, block, 1) + def before_exec(*args, &block) + set_hook(:before_exec, block_given? ? block : args[0], 1) end # sets the timeout of worker processes to +seconds+. Workers |