gitlab-org--gitlab-foss/lib/gitlab/sidekiq_middleware/request_store_middleware.rb
Stan Hu f4aac77389 Add support for using RequestStore within Sidekiq tasks via SIDEKIQ_REQUEST_STORE env variable
This significantly reduces the DB churn in the PostReceive task when it
performs reference extraction.

See #18663
2016-07-25 17:59:09 -07:00

13 lines
246 B
Ruby

module Gitlab
module SidekiqMiddleware
class RequestStoreMiddleware
def call(worker, job, queue)
RequestStore.begin!
yield
ensure
RequestStore.end!
RequestStore.clear!
end
end
end
end