DEV: save missing s3 uploads count in redis

This commit is contained in:
Vinoth Kannan 2019-04-04 19:05:57 +05:30
parent f87b35e6f4
commit df6ef856e6
2 changed files with 3 additions and 0 deletions

View File

@ -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

View File

@ -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