FIX: Bump `GrantEmoji` job to low priority queue and reduce batch size.

This commit is contained in:
Guo Xiang Tan 2016-04-12 16:29:40 +08:00
parent 2aa04611e5
commit ad1d14ecbe
1 changed files with 2 additions and 1 deletions

View File

@ -1,11 +1,12 @@
module Jobs
class GrantEmoji < Jobs::Onceoff
sidekiq_options queue: 'low'
def execute_onceoff(args)
to_award = {}
Post.secured(Guardian.new).visible.public_posts.find_in_batches(batch_size: 5000) do |group|
Post.secured(Guardian.new).visible.public_posts.find_in_batches do |group|
group.each do |p|
doc = Nokogiri::HTML::fragment(p.cooked)
if (doc.css("img.emoji") - doc.css(".quote img")).size > 0