mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-14 00:50:14 -04:00
PERF: hit all index conditions to speed up anon ip tracking
This commit is contained in:
parent
2b2d0e803f
commit
4a48f983fd
2 changed files with 2 additions and 1 deletions
|
@ -33,7 +33,7 @@ class TopicViewItem < ActiveRecord::Base
|
|||
builder = SqlBuilder.new(sql)
|
||||
|
||||
if !user_id
|
||||
builder.where("ip_address = :ip_address AND topic_id = :topic_id")
|
||||
builder.where("ip_address = :ip_address AND topic_id = :topic_id AND user_id IS NULL")
|
||||
else
|
||||
builder.where("user_id = :user_id AND topic_id = :topic_id")
|
||||
end
|
||||
|
|
|
@ -124,6 +124,7 @@ class TopicViewSerializer < ApplicationSerializer
|
|||
def include_is_warning?
|
||||
is_warning
|
||||
end
|
||||
|
||||
def draft
|
||||
object.draft
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue