mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 14:03:18 +08:00
FIX: rake task should rebake posts in descending ID order
This commit is contained in:
parent
d7ea6f93e7
commit
adb93716ca
|
@ -87,10 +87,13 @@ def rebake_posts(opts = {})
|
||||||
total = Post.count
|
total = Post.count
|
||||||
rebaked = 0
|
rebaked = 0
|
||||||
|
|
||||||
Post.find_each do |post|
|
# TODO: make this resumable because carrying around 20 million ids in memory is not a great idea long term
|
||||||
|
Post.order(id: :desc).pluck(:id).in_groups_of(1000, false).each do |batched_post_ids|
|
||||||
|
Post.order(created_at: :desc).where(id: batched_post_ids).each do |post|
|
||||||
rebake_post(post, opts)
|
rebake_post(post, opts)
|
||||||
print_status(rebaked += 1, total)
|
print_status(rebaked += 1, total)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
SiteSetting.disable_edit_notifications = disable_edit_notifications
|
SiteSetting.disable_edit_notifications = disable_edit_notifications
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user