mirror of
https://github.com/discourse/discourse.git
synced 2025-04-01 04:25:56 +08:00
PERF: hit all index conditions to speed up anon ip tracking
This commit is contained in:
parent
2b2d0e803f
commit
4a48f983fd
@ -33,7 +33,7 @@ class TopicViewItem < ActiveRecord::Base
|
|||||||
builder = SqlBuilder.new(sql)
|
builder = SqlBuilder.new(sql)
|
||||||
|
|
||||||
if !user_id
|
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
|
else
|
||||||
builder.where("user_id = :user_id AND topic_id = :topic_id")
|
builder.where("user_id = :user_id AND topic_id = :topic_id")
|
||||||
end
|
end
|
||||||
|
@ -124,6 +124,7 @@ class TopicViewSerializer < ApplicationSerializer
|
|||||||
def include_is_warning?
|
def include_is_warning?
|
||||||
is_warning
|
is_warning
|
||||||
end
|
end
|
||||||
|
|
||||||
def draft
|
def draft
|
||||||
object.draft
|
object.draft
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user