last_data_recv: do not assume Unicorn includes all constants
authorEric Wong <normalperson@yhbt.net>
Tue, 5 Nov 2013 07:05:04 +0000 (5 07:05 +0000)
committerEric Wong <normalperson@yhbt.net>
Tue, 5 Nov 2013 07:05:49 +0000 (5 07:05 +0000)
Some projects may load parts of Unicorn and not others.

lib/raindrops/last_data_recv.rb

index f96a776..b4808a1 100644 (file)
@@ -73,7 +73,9 @@ class Raindrops::LastDataRecv
   # :startdoc
 
   def initialize(opts = {})
-    Raindrops::Aggregate::LastDataRecv.cornify! if defined?(Unicorn)
+    if defined?(Unicorn::HttpServer::LISTENERS)
+      Raindrops::Aggregate::LastDataRecv.cornify!
+    end
     @aggregate =
       opts[:aggregate] || Raindrops::Aggregate::LastDataRecv.default_aggregate
   end