[deploy] Index all readinglist Reactions into Elasticsearch (#7310)
This commit is contained in:
parent
1024e47738
commit
01adfc377c
2 changed files with 29 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
module DataUpdateScripts
|
||||
class IndexReadingListReactions
|
||||
def run
|
||||
Reaction.readinglist.select(:id).in_batches do |batch|
|
||||
Search::BulkIndexToElasticsearchWorker.set(queue: :default).perform_async(
|
||||
"Reaction", batch.pluck(:id)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
require "rails_helper"
|
||||
require Rails.root.join("lib/data_update_scripts/20200415200651_index_reading_list_reactions.rb")
|
||||
|
||||
describe DataUpdateScripts::IndexReadingListReactions, elasticsearch: true do
|
||||
it "indexes feed content(articles, comments, podcast episodes) to Elasticsearch" do
|
||||
reactions = create_list(:reaction, 3, category: "readinglist")
|
||||
Sidekiq::Worker.clear_all
|
||||
|
||||
reactions.each do |reaction|
|
||||
expect { reaction.elasticsearch_doc }.to raise_error(Search::Errors::Transport::NotFound)
|
||||
end
|
||||
|
||||
sidekiq_perform_enqueued_jobs { described_class.new.run }
|
||||
reactions.each do |reaction|
|
||||
expect(reaction.elasticsearch_doc).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue