From e3214e3ac258421ea34b370651f613fb39d4b997 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 19 Jun 2017 08:23:07 +0200 Subject: [PATCH] Improved memory usage on verify storage contend based on checksums. --- app/models/store/file.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/store/file.rb b/app/models/store/file.rb index e79a7ad48..1488c7264 100644 --- a/app/models/store/file.rb +++ b/app/models/store/file.rb @@ -78,7 +78,9 @@ in case of fixing sha hash use: def self.verify(fix_it = nil) success = true - Store::File.all.each { |item| + file_ids = Store::File.all.pluck(:id) + file_ids.each { |item_id| + item = Store::File.find(item_id) content = item.content sha = Digest::SHA256.hexdigest(content) logger.info "CHECK: Store::File.find(#{item.id})"