Method: XRuntime::Middleware#call

Defined in:
lib/x_runtime/middleware.rb

#call(env) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/x_runtime/middleware.rb', line 27

def call(env)
  start_time = Time.now
  status, headers, body = @app.call(env)
  request_time = (Time.now - start_time).to_f*1000
  if request_time >= @threshold
    logredis(request_time, env['REQUEST_PATH'])
  end

  [status, headers, body]
end