Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from rapportive-oss/review.fix-async

Fix time measurement for async
  • Loading branch information...
commit 6b1853877fd18989d038fd1aae3be041d7888ba8 2 parents e0978c6 + 864f595
@samstokes samstokes authored
Showing with 6 additions and 6 deletions.
  1. +5 −5 lib/rack/informant.rb
  2. +1 −1  rack-informant.gemspec
View
10 lib/rack/informant.rb
@@ -30,13 +30,13 @@ def initialize(app, &block)
end
def call(env)
- @start = Time.now
+ start = Time.now
if original_callback = env['async.callback']
env['async.callback'] = proc do |response|
status, headers, body = response
- inform!(env, status, headers, body)
+ inform!(env, start, status, headers, body)
original_callback.call(response)
end
@@ -49,7 +49,7 @@ def call(env)
return [status, headers, body] if status == -1 # alternative async API
# if we got *this* far, @app.call is definitely synchronous
- inform!(env, status, headers, body)
+ inform!(env, start, status, headers, body)
return [status, headers, body]
end
@@ -59,8 +59,8 @@ def call(env)
end
private
- def inform!(env, status, headers, body)
- runtime = Time.now - @start
+ def inform!(env, start, status, headers, body)
+ runtime = Time.now - start
event = {
method: env['REQUEST_METHOD'],
View
2  rack-informant.gemspec
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = 'rack-informant'
s.authors = ['Rapportive Inc']
s.email = 'supportive@rapportive.com'
- s.version = '1.0.0'
+ s.version = '1.1.0'
s.summary = %q{Reporting middleware.}
s.description = "Middleware that reports all requests to an interested party (e.g. for analytics)."
s.homepage = "https://github.com/rapportive-oss/rack-informant"
Please sign in to comment.
Something went wrong with that request. Please try again.