mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
FIX: set missing count in redis even if zero
This commit is contained in:
parent
a5182b0d6c
commit
35431a8ddb
@ -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")
|
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
|
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|
|
missing_uploads.select(:id, :url).find_each do |upload|
|
||||||
log upload.url
|
log upload.url
|
||||||
end
|
end
|
||||||
|
|
||||||
log "#{missing_count} of #{uploads.count} #{model.name.underscore.pluralize} are missing"
|
log "#{missing_count} of #{uploads.count} #{model.name.underscore.pluralize} are missing"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
$redis.set("missing_s3_#{model.table_name}", missing_count)
|
||||||
ensure
|
ensure
|
||||||
connection.exec("DROP TABLE #{table_name}") unless connection.nil?
|
connection.exec("DROP TABLE #{table_name}") unless connection.nil?
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user