Skip to content

Commit

Permalink
PERF: mark posts for rebake vs forcing a rebake inline when migrating…
Browse files Browse the repository at this point in the history
… to s3

Rebaking posts can be expensive instead of blocking here simply mark posts
for rebake.

We can then work through them faster in other jobs, plus this should not
hold of a datacenter migration.
  • Loading branch information
SamSaffron committed May 21, 2019
1 parent 0ed1cfd commit 59012fc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/tasks/uploads.rake
Expand Up @@ -475,13 +475,10 @@ def migrate_to_s3
.where("u.id IS NOT NULL AND u.url LIKE '//%' AND optimized_images.url NOT LIKE '//%'")
.delete_all

puts "Rebaking posts with lightboxes..."
puts "Flagging all posts containing oneboxes for rebake..."

Post.where("cooked LIKE '%class=\"lightbox\"%'").find_each do |post|
putc "."
post.rebake!(priority: :ultra_low)
end
puts
count = Post.where("cooked LIKE '%class=\"lightbox\"%'").update_all(baked_version: Post::BAKED_VERSION - 1)
puts "#{count} posts were flagged for a rebake"
end
end

Expand Down

1 comment on commit 59012fc

@SamSaffron
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.