mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 11:48:28 +08:00
bca126f3f5
Both request tracking and message bus rely on multisite before the
middleware has run which is not ideal.
Follow-up-to: ca1208a636
29 lines
650 B
Ruby
29 lines
650 B
Ruby
# frozen_string_literal: true
|
|
|
|
module RailsMultisite
|
|
class ConnectionManagement
|
|
def self.safe_each_connection
|
|
self.each_connection do |db|
|
|
begin
|
|
yield(db) if block_given?
|
|
rescue => e
|
|
STDERR.puts "URGENT: Failed to initialize site #{db}: "\
|
|
"#{e.class} #{e.message}\n#{e.backtrace.join("\n")}"
|
|
|
|
# the show must go on, don't stop startup if multisite fails
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
class DiscoursePatches
|
|
def self.config
|
|
{
|
|
db_lookup: lambda do |env|
|
|
env["PATH_INFO"] == "/srv/status" ? "default" : nil
|
|
end
|
|
}
|
|
end
|
|
end
|
|
end
|