Commit c1f17d01 authored by Stan Hu's avatar Stan Hu

Merge branch '7003-fail-to-start-server-without-ar-connection' into 'master'

Prevent web-server to start without a working db connection"

Closes #7003

See merge request gitlab-org/gitlab!25160
parents db8d8964 d2518fb8
---
title: Refuse to start web server without a working ActiveRecord connection
merge_request: 25160
author:
type: other
...@@ -14,6 +14,8 @@ end ...@@ -14,6 +14,8 @@ end
if defined?(ActiveRecord::Base) if defined?(ActiveRecord::Base)
Gitlab::Cluster::LifecycleEvents.on_before_fork do Gitlab::Cluster::LifecycleEvents.on_before_fork do
raise 'ActiveRecord connection not established. Unable to start.' unless Gitlab::Database.exists?
# the following is highly recommended for Rails + "preload_app true" # the following is highly recommended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection # as there's no need for the master process to hold a connection
ActiveRecord::Base.connection.disconnect! 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