From 6f349abcbef51825be3003cd88f00b7c1246a800 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 17 Jun 2017 00:54:20 +0200 Subject: [PATCH] Improved memory usage on writing storage from/to fs/database. --- 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 c430e3610..e79a7ad48 100644 --- a/app/models/store/file.rb +++ b/app/models/store/file.rb @@ -116,7 +116,9 @@ nice move to keep system responsive adapter_source = load_adapter("Store::Provider::#{source}") adapter_target = load_adapter("Store::Provider::#{target}") - Store::File.all.each { |item| + file_ids = Store::File.all.pluck(:id) + file_ids.each { |item_id| + item = Store::File.find(item_id) next if item.provider == target content = item.content