about summary refs log tree commit homepage
path: root/lib/raindrops/middleware.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-26 20:59:00 +0000
committerEric Wong <normalperson@yhbt.net>2011-02-26 20:59:00 +0000
commitac6b83ea1c277cd798e2f627fa5eee605efab4fe (patch)
treedfc0fee8c4b95df5ec4ec23f7bd4131e8b1d218e /lib/raindrops/middleware.rb
parente4ab2cc40bdbd1698f4bcf138e83c4823d118f81 (diff)
downloadraindrops-ac6b83ea1c277cd798e2f627fa5eee605efab4fe.tar.gz
Oops!
Diffstat (limited to 'lib/raindrops/middleware.rb')
-rw-r--r--lib/raindrops/middleware.rb15
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