mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-25 07:54:11 -05:00
Internally AR::Base.establish_connection
removes the current connection.
This commit is contained in:
parent
a08496bb1a
commit
c532d7d1ae
2 changed files with 19 additions and 25 deletions
|
@ -24,7 +24,6 @@ class PostgreSQLFallbackHandler
|
|||
|
||||
if connection.active?
|
||||
logger.info "#{self.class}: Master server is active. Reconnecting..."
|
||||
ActiveRecord::Base.remove_connection
|
||||
ActiveRecord::Base.establish_connection(config)
|
||||
Discourse.disable_readonly_mode
|
||||
@master = true
|
||||
|
|
|
@ -27,7 +27,6 @@ describe ActiveRecord::ConnectionHandling do
|
|||
end
|
||||
|
||||
it 'should failover to a replica server' do
|
||||
begin
|
||||
ActiveRecord::Base.expects(:postgresql_connection).with(config).raises(PG::ConnectionBad)
|
||||
ActiveRecord::Base.expects(:verify_replica).with(@replica_connection)
|
||||
|
||||
|
@ -57,10 +56,6 @@ describe ActiveRecord::ConnectionHandling do
|
|||
|
||||
expect(ActiveRecord::Base.connection)
|
||||
.to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
||||
ensure
|
||||
# threads.each { |t| Thread.kill(t) } if threads
|
||||
ActiveRecord::Base.establish_connection(:test)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue