mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
PERF: handle debounce in redis cause SQL can be slow
This commit is contained in:
parent
442a17bfb2
commit
bf68d394f4
2 changed files with 40 additions and 23 deletions
|
@ -2,6 +2,10 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe SearchLog, type: :model do
|
||||
|
||||
before do
|
||||
SearchLog.clear_debounce_cache!
|
||||
end
|
||||
|
||||
describe ".log" do
|
||||
|
||||
context "invalid arguments" do
|
||||
|
@ -122,6 +126,7 @@ RSpec.describe SearchLog, type: :model do
|
|||
expect(action).to eq(:created)
|
||||
|
||||
freeze_time(10.minutes.from_now)
|
||||
$redis.del(SearchLog.redis_key(ip_address: '192.168.0.1', user_id: user.id))
|
||||
|
||||
action, _ = SearchLog.log(
|
||||
term: 'hello',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue