Fix DB load balance autoloading/code-reloading
What does this MR do and why?
This fixes an error that can occur in the GDK when running subsequent pipelines after a gdk_restart
.
NoMethodError - undefined method `use_primary?' for #<ActionDispatch::Request::Session:0x00007fadf8cabe50>:
lib/gitlab/database/load_balancing/sidekiq_client_middleware.rb:43:in `block in wal_location'
lib/gitlab/utils/strong_memoize.rb:30:in `strong_memoize'
lib/gitlab/database/load_balancing/sidekiq_client_middleware.rb:42:in `wal_location'
lib/gitlab/database/load_balancing/sidekiq_client_middleware.rb:38:in `set_data_consistency_locations!'
lib/gitlab/database/load_balancing/sidekiq_client_middleware.rb:15:in `call'
lib/gitlab/sidekiq_middleware/worker_context.rb:9:in `wrap_in_optional_context'
lib/gitlab/sidekiq_middleware/worker_context/client.rb:18:in `call'
config/initializers/forbid_sidekiq_in_transactions.rb:38:in `block (2 levels) in <module:NoEnqueueingFromTransactions>'
app/workers/concerns/application_worker.rb:92:in `perform_async'
app/models/ci/build.rb:202:in `block (2 levels) in <class:Build>'
...
Screenshots or screen recordings
N/A
How to set up and validate locally
- Restart GDK
- Run a pipeline twice. Both should succeed
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jonathan Schafer