ActiveRecord in Rails 5.2 discards connection pools after fork.

This commit is contained in:
Guo Xiang Tan 2018-06-12 09:30:52 +08:00
parent 8d92c73aad
commit 805fd17b23
2 changed files with 0 additions and 6 deletions

View File

@ -205,10 +205,6 @@ before_fork do |server, worker|
end
RailsMultisite::ConnectionManagement.each_connection do
ActiveRecord::Base.connection_pool.disconnect!
end
$redis._client.disconnect
# Throttle the master from forking too quickly by sleeping. Due

View File

@ -436,8 +436,6 @@ module Discourse
# in a bad state
def self.after_fork
# note: all this reconnecting may no longer be needed per https://github.com/redis/redis-rb/pull/414
current_db = RailsMultisite::ConnectionManagement.current_db
RailsMultisite::ConnectionManagement.establish_connection(db: current_db)
MessageBus.after_fork
SiteSetting.after_fork
$redis._client.reconnect