Clear AR connections before starting Sidekiq
This should ensure that connections obtained before starting Sidekiq are not leaked, leading to connection timeouts. Fixes gitlab-com/infrastructure#1139
This commit is contained in:
parent
7f2819b778
commit
fb697e69f2
2 changed files with 10 additions and 0 deletions
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Clear ActiveRecord connections before starting Sidekiq
|
||||
merge_request:
|
||||
author:
|
|
@ -19,6 +19,12 @@ Sidekiq.configure_server do |config|
|
|||
chain.add Gitlab::SidekiqStatus::ClientMiddleware
|
||||
end
|
||||
|
||||
config.on :startup do
|
||||
# Clear any connections that might have been obtained before starting
|
||||
# Sidekiq (e.g. in an initializer).
|
||||
ActiveRecord::Base.clear_all_connections!
|
||||
end
|
||||
|
||||
# Sidekiq-cron: load recurring jobs from gitlab.yml
|
||||
# UGLY Hack to get nested hash from settingslogic
|
||||
cron_jobs = JSON.parse(Gitlab.config.cron_jobs.to_json)
|
||||
|
|
Loading…
Reference in a new issue