mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
ActiveRecord in Rails 5.2 discards connection pools after fork.
This commit is contained in:
@ -205,10 +205,6 @@ before_fork do |server, worker|
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RailsMultisite::ConnectionManagement.each_connection do
|
|
||||||
ActiveRecord::Base.connection_pool.disconnect!
|
|
||||||
end
|
|
||||||
|
|
||||||
$redis._client.disconnect
|
$redis._client.disconnect
|
||||||
|
|
||||||
# Throttle the master from forking too quickly by sleeping. Due
|
# Throttle the master from forking too quickly by sleeping. Due
|
||||||
|
@ -436,8 +436,6 @@ module Discourse
|
|||||||
# in a bad state
|
# in a bad state
|
||||||
def self.after_fork
|
def self.after_fork
|
||||||
# note: all this reconnecting may no longer be needed per https://github.com/redis/redis-rb/pull/414
|
# 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
|
MessageBus.after_fork
|
||||||
SiteSetting.after_fork
|
SiteSetting.after_fork
|
||||||
$redis._client.reconnect
|
$redis._client.reconnect
|
||||||
|
Reference in New Issue
Block a user