2021-12-11 22:18:48 +05:30
|
|
|
# rubocop:disable Naming/FileName
|
2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
2018-03-27 19:54:05 +05:30
|
|
|
module Middleware
|
|
|
|
# Some of middleware would hold env for no good reason even after the
|
|
|
|
# request had already been processed, and we could not garbage collect
|
|
|
|
# them due to this. Put this middleware as the first middleware so that
|
|
|
|
# it would clear the env after the request is done, allowing GC gets a
|
|
|
|
# chance to release memory for the last request.
|
|
|
|
ReleaseEnv = Struct.new(:app) do
|
|
|
|
def call(env)
|
|
|
|
app.call(env).tap { env.clear }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-12-11 22:18:48 +05:30
|
|
|
|
|
|
|
# rubocop:enable Naming/FileName
|