Merge branch 'dm-batch-loader-sidekiq' into 'master'
Clear BatchLoader context between Sidekiq jobs Closes #53079 See merge request gitlab-org/gitlab-ce!23308
This commit is contained in:
commit
a033faa2a6
3 changed files with 19 additions and 0 deletions
5
changelogs/unreleased/dm-batch-loader-sidekiq.yml
Normal file
5
changelogs/unreleased/dm-batch-loader-sidekiq.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Clear BatchLoader context between Sidekiq jobs
|
||||
merge_request: 23308
|
||||
author:
|
||||
type: fixed
|
|
@ -20,6 +20,7 @@ Sidekiq.configure_server do |config|
|
|||
chain.add Gitlab::SidekiqMiddleware::ArgumentsLogger if ENV['SIDEKIQ_LOG_ARGUMENTS'] && !enable_json_logs
|
||||
chain.add Gitlab::SidekiqMiddleware::Shutdown
|
||||
chain.add Gitlab::SidekiqMiddleware::RequestStoreMiddleware unless ENV['SIDEKIQ_REQUEST_STORE'] == '0'
|
||||
chain.add Gitlab::SidekiqMiddleware::BatchLoader
|
||||
chain.add Gitlab::SidekiqStatus::ServerMiddleware
|
||||
end
|
||||
|
||||
|
|
13
lib/gitlab/sidekiq_middleware/batch_loader.rb
Normal file
13
lib/gitlab/sidekiq_middleware/batch_loader.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Gitlab
|
||||
module SidekiqMiddleware
|
||||
class BatchLoader
|
||||
def call(worker, job, queue)
|
||||
yield
|
||||
ensure
|
||||
::BatchLoader::Executor.clear_current
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue