Properly measure request time using Time.monotonic
This commit is contained in:
commit
5267555322
1 changed files with 3 additions and 4 deletions
|
@ -5,10 +5,9 @@ module Kemal
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(context : HTTP::Server::Context)
|
def call(context : HTTP::Server::Context)
|
||||||
time = Time.now
|
elapsed_time = Time.measure { call_next(context) }
|
||||||
call_next(context)
|
elapsed_text = elapsed_text(elapsed_time)
|
||||||
elapsed_text = elapsed_text(Time.now - time)
|
@io << Time.now << ' ' << context.response.status_code << ' ' << context.request.method << ' ' << context.request.resource << ' ' << elapsed_text << '\n'
|
||||||
@io << time << ' ' << context.response.status_code << ' ' << context.request.method << ' ' << context.request.resource << ' ' << elapsed_text << '\n'
|
|
||||||
context
|
context
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue