e936a85877ca622b916519e92376c8f3da73d18b
[unicorn.git] / t / oob_gc_path.ru
blobe936a85877ca622b916519e92376c8f3da73d18b
1 #\-E none
2 require 'unicorn/oob_gc'
3 use Rack::ContentLength
4 use Rack::ContentType, "text/plain"
5 use Unicorn::OobGC, 5, /BAD/
6 $gc_started = false
8 # Mock GC.start
9 def GC.start
10   ObjectSpace.each_object(BasicSocket) do |x|
11     next if Unicorn::HttpServer::LISTENERS.include?(x)
12     x.closed? or abort "not closed #{x}"
13   end
14   $gc_started = true
15 end
16 run lambda { |env|
17   if "/gc_reset" == env["PATH_INFO"] && "POST" == env["REQUEST_METHOD"]
18     $gc_started = false
19   end
20   [ 200, {}, [ "#$gc_started\n" ] ]