Commit d2518fb8 authored by nmilojevic1's avatar nmilojevic1

Fold logic inside one on_before_fork

parent 31dad0fd
......@@ -12,14 +12,10 @@ if defined?(ActiveRecord::Base) && !Gitlab::Runtime.sidekiq?
end
end
if defined?(ActiveRecord::Base) && Gitlab::Runtime.web_server?
if defined?(ActiveRecord::Base)
Gitlab::Cluster::LifecycleEvents.on_before_fork do
raise 'ActiveRecord connection not established. Unable to start.' unless Gitlab::Database.exists?
end
end
if defined?(ActiveRecord::Base)
Gitlab::Cluster::LifecycleEvents.on_before_fork do
# the following is highly recommended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection
ActiveRecord::Base.connection.disconnect!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment