mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:44:49 +08:00
DEV: save missing s3 uploads count in redis
This commit is contained in:
parent
f87b35e6f4
commit
df6ef856e6
|
@ -58,6 +58,8 @@ class S3Inventory
|
|||
missing_uploads = uploads.joins("LEFT JOIN #{table_name} ON #{table_name}.etag = #{model.table_name}.etag").where("#{table_name}.etag is NULL")
|
||||
|
||||
if (missing_count = missing_uploads.count) > 0
|
||||
$redis.set("missing_s3_#{model.table_name}", missing_count)
|
||||
|
||||
missing_uploads.select(:id, :url).find_each do |upload|
|
||||
log upload.url
|
||||
end
|
||||
|
|
|
@ -75,6 +75,7 @@ describe "S3Inventory" do
|
|||
end
|
||||
|
||||
expect(output).to eq("#{upload.url}\n1 of 4 uploads are missing\n")
|
||||
expect($redis.get("missing_s3_uploads")).to eq("1")
|
||||
end
|
||||
|
||||
it "should backfill etags to uploads table correctly" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user