diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-26 20:59:00 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-26 20:59:00 +0000 |
commit | ac6b83ea1c277cd798e2f627fa5eee605efab4fe (patch) | |
tree | dfc0fee8c4b95df5ec4ec23f7bd4131e8b1d218e /lib | |
parent | e4ab2cc40bdbd1698f4bcf138e83c4823d118f81 (diff) | |
download | raindrops-ac6b83ea1c277cd798e2f627fa5eee605efab4fe.tar.gz |
Oops!
Diffstat (limited to 'lib')
-rw-r--r-- | lib/raindrops/middleware.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/raindrops/middleware.rb b/lib/raindrops/middleware.rb index ea19ffc..af3442c 100644 --- a/lib/raindrops/middleware.rb +++ b/lib/raindrops/middleware.rb @@ -32,17 +32,18 @@ class Raindrops::Middleware # standard Rack endpoint def call(env) env[PATH_INFO] == @path and return stats_response + begin + @stats.incr_calling - @stats.incr_calling + status, headers, body = @app.call(env) + rv = [ status, headers, Proxy.new(body, @stats) ] - status, headers, body = @app.call(env) - rv = [ status, headers, Proxy.new(body, @stats) ] - - # the Rack server will start writing headers soon after this method - @stats.incr_writing - rv + # the Rack server will start writing headers soon after this method + @stats.incr_writing + rv ensure @stats.decr_calling + end end class Proxy |