Remove Context#app to reduce GC load (experimental)

This commit is contained in:
Johannes Müller 2017-10-18 17:53:44 +02:00 committed by sdogruyol
parent 72bcac6dd5
commit 5917af3f14
5 changed files with 8 additions and 15 deletions

View file

@ -12,11 +12,10 @@ class CustomLogHandler < Kemal::BaseLogHandler
end
end
def create_request_and_return_io(handler, request, app = Kemal.application)
def create_request_and_return_io(handler, request)
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
context.app = app
handler.call(context)
response.close
io.rewind