Commit ffd4d50c authored by nmilojevic1's avatar nmilojevic1

Move logic to active_record_lifecycle

parent d0fb0a2a
......@@ -12,6 +12,14 @@ if defined?(ActiveRecord::Base) && !Gitlab::Runtime.sidekiq?
end
end
if defined?(ActiveRecord::Base) && Gitlab::Runtime.web_server?
Gitlab::Cluster::LifecycleEvents.on_before_fork do
ActiveSupport.on_load(:active_record) do
raise 'ActiveRecord connection not established. Unable to start.' unless ::ActiveRecord::Base.connected?
end
end
end
if defined?(ActiveRecord::Base)
Gitlab::Cluster::LifecycleEvents.on_before_fork do
# the following is highly recommended for Rails + "preload_app true"
......
......@@ -6,7 +6,6 @@ module Gitlab
module PumaCluster
def self.prepended(base)
raise 'missing method Puma::Cluster#stop_workers' unless base.method_defined?(:stop_workers)
raise 'ActiveRecord connection not established. Unable to start.' unless ActiveRecord::Base.connected?
end
# This looks at internal status of `Puma::Cluster`
......
......@@ -8,8 +8,6 @@ module Gitlab
unless base.method_defined?(:reexec) && base.method_defined?(:stop)
raise 'missing method Unicorn::HttpServer#reexec or Unicorn::HttpServer#stop'
end
raise 'ActiveRecord connection not established. Unable to start.' unless ::ActiveRecord::Base.connected?
end
def reexec
......
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