From dd2b2274ef0cd8a121cf7655ade939a1f63bc971 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 25 Nov 2009 19:01:34 -0800 Subject: AppPool middleware now compatible with Fibers This enables the safe use of Rainbows::AppPool with all concurrency models, not just threaded ones. AppPool is now effective with *all* Fiber-based concurrency models including Revactor (and of course the new Fiber{Pool,Spawn} ones). --- t/t9000-rack-app-pool.sh | 2 +- t/t9000.ru | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/t9000-rack-app-pool.sh b/t/t9000-rack-app-pool.sh index cd08724..544532b 100755 --- a/t/t9000-rack-app-pool.sh +++ b/t/t9000-rack-app-pool.sh @@ -1,7 +1,7 @@ #!/bin/sh . ./test-lib.sh case $model in -*Thread*) ;; +*Thread*|*Fiber*|Revactor) ;; *) t_info "skipping $T since it's not compatible with $model" exit 0 diff --git a/t/t9000.ru b/t/t9000.ru index af6b4fc..4ca36c1 100644 --- a/t/t9000.ru +++ b/t/t9000.ru @@ -1,13 +1,16 @@ use Rack::ContentLength use Rack::ContentType use Rainbows::AppPool, :size => ENV['APP_POOL_SIZE'].to_i -sleep_class = ENV['SLEEP_CLASS'] -sleep_class = sleep_class ? Object.const_get(sleep_class) : Kernel class Sleeper def call(env) - sleep_class = ENV['SLEEP_CLASS'] - sleep_class = sleep_class ? Object.const_get(sleep_class) : Kernel - sleep_class.sleep 1 + (case env['rainbows.model'] + when :FiberPool, :FiberSpawn + Rainbows::Fiber + when :Revactor + Actor + else + Kernel + end).sleep(1) [ 200, {}, [ "#{object_id}\n" ] ] end end -- cgit v1.2.3-24-ge0c7