PERF: improve performance of emoji grants
This commit is contained in:
parent
983d64fd56
commit
144bf07886
|
@ -6,7 +6,12 @@ module Jobs
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
to_award = {}
|
to_award = {}
|
||||||
|
|
||||||
Post.secured(Guardian.new).visible.public_posts.find_in_batches do |group|
|
Post.secured(Guardian.new)
|
||||||
|
.select(:id, :created_at, :cooked, :user_id)
|
||||||
|
.visible
|
||||||
|
.public_posts
|
||||||
|
.where("cooked like '%emoji%'")
|
||||||
|
.find_in_batches do |group|
|
||||||
group.each do |p|
|
group.each do |p|
|
||||||
doc = Nokogiri::HTML::fragment(p.cooked)
|
doc = Nokogiri::HTML::fragment(p.cooked)
|
||||||
if (doc.css("img.emoji") - doc.css(".quote img")).size > 0
|
if (doc.css("img.emoji") - doc.css(".quote img")).size > 0
|
||||||
|
|
Loading…
Reference in New Issue