chore: Move embedding generation to sidekiq (#9238)
chore: Move embedding generation to a job
This commit is contained in:
7
enterprise/app/jobs/portal/article_indexing_job.rb
Normal file
7
enterprise/app/jobs/portal/article_indexing_job.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class Portal::ArticleIndexingJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(article)
|
||||
article.generate_and_save_article_seach_terms
|
||||
end
|
||||
end
|
||||
@@ -39,6 +39,10 @@ module Enterprise::Concerns::Article
|
||||
def add_article_embedding
|
||||
return unless account.feature_enabled?('help_center_embedding_search')
|
||||
|
||||
Portal::ArticleIndexingJob.perform_later(self)
|
||||
end
|
||||
|
||||
def generate_and_save_article_seach_terms
|
||||
terms = generate_article_search_terms
|
||||
article_embeddings.destroy_all
|
||||
terms.each { |term| article_embeddings.create!(term: term) }
|
||||
|
||||
Reference in New Issue
Block a user