mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Update index for category in a background job.
Search indexing can get expensive and there is no need for us to block the entire request just to wait for index to finish.
This commit is contained in:
committed by
Alan Guo Xiang Tan
parent
94cd5ac0b1
commit
650da7b626
@@ -778,11 +778,10 @@ class Category < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def index_search
|
||||
if saved_change_to_attribute?(:name)
|
||||
SearchIndexer.queue_category_posts_reindex(self.id)
|
||||
end
|
||||
|
||||
SearchIndexer.index(self)
|
||||
Jobs.enqueue(:index_category_for_search,
|
||||
category_id: self.id,
|
||||
force: saved_change_to_attribute?(:name),
|
||||
)
|
||||
end
|
||||
|
||||
def update_reviewables
|
||||
|
||||
Reference in New Issue
Block a user