mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 04:13:53 +08:00
DEV: add unique missing uploads index in post custom fields
https://review.discourse.org/t/feature-send-missing-post-uploads-stat-to-prometheus/2609/6?u=vinothkannans
This commit is contained in:
@ -390,8 +390,7 @@ end
|
||||
|
||||
desc 'Finds missing post upload records from cooked HTML content'
|
||||
task 'posts:missing_uploads' => :environment do
|
||||
name = "missing_uploads"
|
||||
PostCustomField.where(name: name).destroy_all
|
||||
PostCustomField.where(name: Post::MISSING_UPLOADS).destroy_all
|
||||
posts = Post.have_uploads.select(:id, :cooked)
|
||||
count = 0
|
||||
|
||||
@ -409,7 +408,7 @@ task 'posts:missing_uploads' => :environment do
|
||||
end
|
||||
|
||||
if missing.present?
|
||||
missing.each { |src| PostCustomField.create!(post_id: post.id, name: name, value: src) }
|
||||
PostCustomField.create!(post_id: post.id, name: Post::MISSING_UPLOADS, value: missing.to_json)
|
||||
count += missing.count
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user