mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 02:41:13 +08:00
BUGFIX: Correct after_fork semantics
After fork SiteSettings was not getting a new process id, causing site settings not to refresh properly in unicorn This code also centralizes the logic
This commit is contained in:
@ -234,4 +234,17 @@ module Discourse
|
||||
"/site/read-only"
|
||||
end
|
||||
|
||||
# all forking servers must call this
|
||||
# after fork, otherwise Discourse will be
|
||||
# in a bad state
|
||||
def self.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
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user