Remove use of concurrent timer for Redis failover.

* Uses the same logic for Postgres failover.
This commit is contained in:
Guo Xiang Tan
2017-10-05 15:57:08 +08:00
parent 5dc4b469be
commit b2127600fb
2 changed files with 21 additions and 23 deletions

View File

@ -135,14 +135,13 @@ describe DiscourseRedis do
error = RuntimeError.new('Name or service not known')
expect { connector.resolve(BrokenRedis.new(error)) }.to raise_error(error)
fallback_handler.instance_variable_get(:@timer_task).shutdown
expect(fallback_handler.running?).to eq(false)
expect(fallback_handler.master).to eq(false)
config = connector.resolve
expect(config[:host]).to eq(slave_host)
expect(config[:port]).to eq(slave_port)
expect(fallback_handler.running?).to eq(true)
expect(fallback_handler.master).to eq(false)
ensure
fallback_handler.master = true
end