From e8cedc2584d23a8ab214ff96a973dc37344c2796 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 4 May 2010 13:41:55 -0700 Subject: drop EventMachineDefer concurrency model Since we have conditional deferred execution in the regular EventMachine concurrency model, we can drop this one. This concurrency model never fully worked due to lack of graceful shut downs, and was never promoted nor supported, either. --- lib/rainbows.rb | 1 - lib/rainbows/event_machine_defer.rb | 59 ------------------------------------- lib/rainbows/http_server.rb | 6 +--- t/simple-http_EventMachineDefer.ru | 11 ------- 4 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 lib/rainbows/event_machine_defer.rb delete mode 100644 t/simple-http_EventMachineDefer.ru diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 30b5fd5..b203c93 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -140,7 +140,6 @@ module Rainbows :RevThreadSpawn => 50, :RevThreadPool => 50, :EventMachine => 50, - :EventMachineDefer => 50, :FiberSpawn => 50, :FiberPool => 50, :ActorSpawn => 50, diff --git a/lib/rainbows/event_machine_defer.rb b/lib/rainbows/event_machine_defer.rb deleted file mode 100644 index 97518c5..0000000 --- a/lib/rainbows/event_machine_defer.rb +++ /dev/null @@ -1,59 +0,0 @@ -# -*- encoding: binary -*- -# :stopdoc: -# FIXME: fails many tests, experimental -require 'rainbows/event_machine' - -module Rainbows - - # This is currently highly experimental - module EventMachineDefer - include Rainbows::EventMachine - - class Client < Rainbows::EventMachine::Client - undef_method :app_call - - def defer_op - @env[RACK_INPUT] = @input - @env[REMOTE_ADDR] = @remote_addr - @env[ASYNC_CALLBACK] = method(:response_write) - catch(:async) { APP.call(@env.update(RACK_DEFAULTS)) } - rescue => e - handle_error(e) - nil - end - - def defer_callback(response) - # too tricky to support pipelining with :async since the - # second (pipelined) request could be a stuck behind a - # long-running async response - (response.nil? || -1 == response.first) and return @state = :close - - resume - - alive = @hp.keepalive? && G.alive - out = [ alive ? CONN_ALIVE : CONN_CLOSE ] if @hp.headers? - response_write(response, out, alive) - if alive - @env.clear - @hp.reset - @state = :headers - if @hp.headers(@env, @buf) - EM.next_tick(method(:app_call)) - else - set_comm_inactivity_timeout(G.kato) - end - else - quit - end - end - - def app_call - pause - set_comm_inactivity_timeout(0) - # defer_callback(defer_op) - EM.defer(method(:defer_op), method(:defer_callback)) - end - end - - end -end diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index 50231ff..d009e50 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -60,11 +60,7 @@ module Rainbows end mod.setup if mod.respond_to?(:setup) Const::RACK_DEFAULTS['rainbows.model'] = @use = model.to_sym - - Const::RACK_DEFAULTS['rack.multithread'] = case model.to_s - when /Thread/, "EventMachineDefer"; true - else false - end + Const::RACK_DEFAULTS['rack.multithread'] = !!(model.to_s =~ /Thread/) case @use when :Rev, :EventMachine, :NeverBlock diff --git a/t/simple-http_EventMachineDefer.ru b/t/simple-http_EventMachineDefer.ru deleted file mode 100644 index 71269fa..0000000 --- a/t/simple-http_EventMachineDefer.ru +++ /dev/null @@ -1,11 +0,0 @@ -use Rack::ContentLength -use Rack::ContentType -run lambda { |env| - if env['rack.multithread'] == true && - EM.reactor_running? && - env['rainbows.model'] == :EventMachineDefer - [ 200, {}, [ env.inspect << "\n" ] ] - else - raise "incorrect parameters" - end -} -- cgit v1.2.3-24-ge0c7