Use perform_bulk in Podcasts::EnqueueGetEpisodesWorker (#16325)

This commit is contained in:
Michael Kohl 2022-01-28 11:32:25 +07:00 committed by GitHub
parent 30d2ec6220
commit 914b984e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,9 +5,9 @@ module Podcasts
sidekiq_options queue: :medium_priority, retry: 10
def perform
Podcast.published.select(:id).find_each do |podcast|
Podcasts::GetEpisodesWorker.perform_async("podcast_id" => podcast.id, "limit" => 5)
end
# `perform_bulk` expects an array of argument arrays we need to wrap the hashes.
job_params = Podcast.published.ids.map { |id| [{ "podcast_id" => id, "limit" => 5 }] }
Podcasts::GetEpisodesWorker.perform_bulk(job_params)
end
end
end