From a5d88662a519406eea6f180a010af8ef829464e7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 21 Nov 2015 08:52:29 +0000 Subject: Ruby 1.9.3+-only cleanups unicorn 5 will only support Ruby 1.9.3 and later, so remove some checks for Hash#compare_by_identity and IO.copy_stream which we know exist in Ruby 1.9. Favor &:sym proc dispatch to avoid unnecessary captures and bytecode size increases, too. Finally, ensure we fail fast by converting some literal hashes to use non-arrow syntax for symbolic keys. --- lib/rainbows.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/rainbows.rb') diff --git a/lib/rainbows.rb b/lib/rainbows.rb index f23b387..6e7e4f2 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -11,8 +11,7 @@ module Rainbows # map of numeric file descriptors to IO objects to avoid using IO.new # and potentially causing race conditions when using /dev/fd/ - FD_MAP = {} - FD_MAP.compare_by_identity if FD_MAP.respond_to?(:compare_by_identity) + FD_MAP = {}.compare_by_identity require 'rainbows/const' require 'rainbows/http_parser' @@ -92,7 +91,7 @@ module Rainbows tmp = @readers.dup @readers.clear tmp.each { |s| s.close rescue nil }.clear - @at_quit.each { |task| task.call } + @at_quit.each(&:call) # XXX hack to break out of IO.select in worker_loop for some models Process.kill(:QUIT, $$) -- cgit v1.2.3-24-ge0c7