lib/rbmk/server.rb in rbmk-0.1.0.f vs lib/rbmk/server.rb in rbmk-0.1.0.g

- old
+ new

@@ -1,6 +1,5 @@ -require 'timeout' require 'rbmk/peer' module RBMK class Server %w( CHLD INT HUP QUIT TERM ).each { |sig| const_set ('SIG%s' % sig).to_sym, Signal.list[sig] } @@ -33,11 +32,10 @@ protected def self.host; '127.0.0.1' end def self.port; 8389 end - def self.worker_timeout; 600 end # (in seconds) this is not per single request, this is for the whole session def self.upstream require 'rbmk/upstream' RBMK::Upstream.new end @@ -68,10 +66,10 @@ def act_as_a_child_for peer Signal.trap 'CHLD', 'SYSTEM_DEFAULT' $master = false remove_instance_variable :@workers $0 = sprintf '%s worker for %s', @arvg0, peer - Timeout.timeout(self.class.worker_timeout) { serve peer } # FIXME shall move to master in the future or maybe drop altogether in favour of activity detection + serve peer rescue SignalException $log.debug 'Trapped %p' % ($!.signm.empty? ? 'SIGINT' : $!.signm) raise $! rescue Exception $!.log