mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 22:51:06 +08:00
PERF: Use Redis SET EX GET
instead of LUA script for counting (#15939)
This will prevent Discourse from booting on Redis < 6.2.0
This commit is contained in:

committed by
GitHub

parent
a48231041b
commit
4d3da70bc6
@ -30,14 +30,14 @@ describe ApplicationRequest do
|
||||
inc(:http_total)
|
||||
|
||||
Discourse.redis.without_namespace.stubs(:incr).raises(Redis::CommandError.new("READONLY"))
|
||||
Discourse.redis.without_namespace.stubs(:eval).raises(Redis::CommandError.new("READONLY"))
|
||||
Discourse.redis.without_namespace.stubs(:set).raises(Redis::CommandError.new("READONLY"))
|
||||
|
||||
# flush will be deferred no error raised
|
||||
inc(:http_total, autoflush: 3)
|
||||
ApplicationRequest.write_cache!
|
||||
|
||||
Discourse.redis.without_namespace.unstub(:incr)
|
||||
Discourse.redis.without_namespace.unstub(:eval)
|
||||
Discourse.redis.without_namespace.unstub(:set)
|
||||
|
||||
inc(:http_total, autoflush: 3)
|
||||
expect(ApplicationRequest.http_total.first.count).to eq(3)
|
||||
|
Reference in New Issue
Block a user