Commit ccb6819102240ec717c3357a6d7b13d59b31f823
1 parent
3eef3769
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
virtuoso: avoid loading all objects into memory
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
plugins/virtuoso/lib/virtuoso_plugin/noosfero_harvest.rb
| @@ -48,7 +48,7 @@ class VirtuosoPlugin::NoosferoHarvest | @@ -48,7 +48,7 @@ class VirtuosoPlugin::NoosferoHarvest | ||
| 48 | def triplify_comments(article) | 48 | def triplify_comments(article) |
| 49 | total = article.comments.count | 49 | total = article.comments.count |
| 50 | count = 0 | 50 | count = 0 |
| 51 | - article.comments.each do |comment| | 51 | + article.comments.find_each do |comment| |
| 52 | begin | 52 | begin |
| 53 | subject_identifier = url_for(comment.url) | 53 | subject_identifier = url_for(comment.url) |
| 54 | puts "triplify #{subject_identifier} comment (#{count+=1}/#{total})" | 54 | puts "triplify #{subject_identifier} comment (#{count+=1}/#{total})" |
| @@ -91,7 +91,7 @@ class VirtuosoPlugin::NoosferoHarvest | @@ -91,7 +91,7 @@ class VirtuosoPlugin::NoosferoHarvest | ||
| 91 | def triplify_profiles | 91 | def triplify_profiles |
| 92 | total = environment.profiles.count | 92 | total = environment.profiles.count |
| 93 | count = 0 | 93 | count = 0 |
| 94 | - environment.profiles.each do |profile| | 94 | + environment.profiles.find_each do |profile| |
| 95 | begin | 95 | begin |
| 96 | subject_identifier = url_for(profile.url) | 96 | subject_identifier = url_for(profile.url) |
| 97 | puts "triplify #{subject_identifier} profile (#{count+=1}/#{total})" | 97 | puts "triplify #{subject_identifier} profile (#{count+=1}/#{total})" |