From 35431a8ddb2a16578d2707a6499828365c5aa78a Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Thu, 4 Apr 2019 20:05:25 +0530 Subject: [PATCH] FIX: set missing count in redis even if zero --- lib/s3_inventory.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/s3_inventory.rb b/lib/s3_inventory.rb index e43ab374d8b..f6b053a27b2 100644 --- a/lib/s3_inventory.rb +++ b/lib/s3_inventory.rb @@ -58,14 +58,14 @@ 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 log "#{missing_count} of #{uploads.count} #{model.name.underscore.pluralize} are missing" end + + $redis.set("missing_s3_#{model.table_name}", missing_count) ensure connection.exec("DROP TABLE #{table_name}") unless connection.nil? end