mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:21:12 +08:00
BUGFIX: properly reconnect to the current db after forking
This commit is contained in:
@ -238,11 +238,12 @@ module Discourse
|
||||
# after fork, otherwise Discourse will be
|
||||
# in a bad state
|
||||
def self.after_fork
|
||||
current_db = RailsMultisite::ConnectionManagement.current_db
|
||||
RailsMultisite::ConnectionManagement.establish_connection(db: current_db)
|
||||
MessageBus.after_fork
|
||||
SiteSetting.after_fork
|
||||
ActiveRecord::Base.establish_connection
|
||||
$redis.client.reconnect
|
||||
Rails.cache.reconnect
|
||||
MessageBus.after_fork
|
||||
# /!\ HACK /!\ force sidekiq to create a new connection to redis
|
||||
Sidekiq.instance_variable_set(:@redis, nil)
|
||||
end
|
||||
|
Reference in New Issue
Block a user