gitlab-org--gitlab-foss/lib/gitlab/middleware/release_env.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
611 B
Ruby
Raw Normal View History

# rubocop:disable Naming/FileName
# frozen_string_literal: true
module Gitlab
2018-02-07 09:44:05 -05:00
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
# rubocop:enable Naming/FileName