mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
don't risk being stuck in readonly
This commit is contained in:
parent
877b7be579
commit
7ca8853861
@ -19,20 +19,26 @@ describe ApplicationRequest do
|
|||||||
ApplicationRequest.last_flush = Time.now.utc
|
ApplicationRequest.last_flush = Time.now.utc
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'works even if redis is in readonly' do
|
context "readonly test" do
|
||||||
disable_date_flush!
|
after do
|
||||||
|
$redis.slaveof("no", "one")
|
||||||
|
end
|
||||||
|
|
||||||
inc(:http_total)
|
it 'works even if redis is in readonly' do
|
||||||
inc(:http_total)
|
disable_date_flush!
|
||||||
|
|
||||||
$redis.slaveof("127.0.0.1", 666)
|
inc(:http_total)
|
||||||
|
inc(:http_total)
|
||||||
|
|
||||||
# flush will be deferred no error raised
|
$redis.slaveof("127.0.0.1", 666)
|
||||||
inc(:http_total, autoflush: 3)
|
|
||||||
$redis.slaveof("no", "one")
|
|
||||||
|
|
||||||
inc(:http_total, autoflush: 3)
|
# flush will be deferred no error raised
|
||||||
expect(ApplicationRequest.http_total.first.count).to eq(3)
|
inc(:http_total, autoflush: 3)
|
||||||
|
$redis.slaveof("no", "one")
|
||||||
|
|
||||||
|
inc(:http_total, autoflush: 3)
|
||||||
|
expect(ApplicationRequest.http_total.first.count).to eq(3)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'logs nothing for an unflushed increment' do
|
it 'logs nothing for an unflushed increment' do
|
||||||
|
Loading…
Reference in New Issue
Block a user