Commit ccb6819102240ec717c3357a6d7b13d59b31f823

Authored by Victor Costa
1 parent 3eef3769

virtuoso: avoid loading all objects into memory

plugins/virtuoso/lib/virtuoso_plugin/noosfero_harvest.rb
... ... @@ -48,7 +48,7 @@ class VirtuosoPlugin::NoosferoHarvest
48 48 def triplify_comments(article)
49 49 total = article.comments.count
50 50 count = 0
51   - article.comments.each do |comment|
  51 + article.comments.find_each do |comment|
52 52 begin
53 53 subject_identifier = url_for(comment.url)
54 54 puts "triplify #{subject_identifier} comment (#{count+=1}/#{total})"
... ... @@ -91,7 +91,7 @@ class VirtuosoPlugin::NoosferoHarvest
91 91 def triplify_profiles
92 92 total = environment.profiles.count
93 93 count = 0
94   - environment.profiles.each do |profile|
  94 + environment.profiles.find_each do |profile|
95 95 begin
96 96 subject_identifier = url_for(profile.url)
97 97 puts "triplify #{subject_identifier} profile (#{count+=1}/#{total})"
... ...