mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 14:03:22 +08:00
BUGFIX: properly reconnect to the current db after forking
This commit is contained in:
parent
7e7ca43a19
commit
bb0baa6d7c
|
@ -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
|
||||
|
|
|
@ -144,6 +144,7 @@ module Export
|
|||
pg_dump_running = true
|
||||
|
||||
Thread.new do
|
||||
RailsMultisite::ConnectionManagement::establish_connection(db: @current_db)
|
||||
while pg_dump_running
|
||||
message = logs.pop.strip
|
||||
log(message) unless message.blank?
|
||||
|
|
Loading…
Reference in New Issue
Block a user