FIX: Incorrect subscription in `PostgreSQLFallbackHandler`.
This commit is contained in:
parent
c5dd4bf5dc
commit
426907cb88
|
@ -16,8 +16,8 @@ class PostgreSQLFallbackHandler
|
|||
@mutex = Mutex.new
|
||||
@initialized = false
|
||||
|
||||
MessageBus.subscribe(DATABASE_DOWN_CHANNEL) do |payload, pid|
|
||||
if @initialized && pid != Process.pid
|
||||
MessageBus.subscribe(DATABASE_DOWN_CHANNEL) do |payload|
|
||||
if @initialized && payload.data["pid"].to_i != Process.pid
|
||||
begin
|
||||
RailsMultisite::ConnectionManagement.with_connection(payload.data['db']) do
|
||||
clear_connections
|
||||
|
|
|
@ -81,6 +81,7 @@ describe ActiveRecord::ConnectionHandling do
|
|||
end.first
|
||||
|
||||
expect(message.data[:db]).to eq('default')
|
||||
expect(message.data[:pid]).to eq(Process.pid)
|
||||
|
||||
expect { ActiveRecord::Base.postgresql_fallback_connection(config) }
|
||||
.to change { Discourse.readonly_mode? }.from(false).to(true)
|
||||
|
|
Loading…
Reference in New Issue