Small performance improvement for sync with many new articles

This commit is contained in:
wvengen 2019-03-24 22:02:53 +01:00
parent 5fa61912c9
commit cd164bc3eb

View file

@ -56,7 +56,7 @@ class Supplier < ApplicationRecord
shared_supplier shared_supplier
.shared_articles .shared_articles
.where.not(id: existing_articles.to_a) .where.not(id: existing_articles.to_a)
.each { |shared_article| new_articles << shared_article.build_new_article(self) } .find_each { |new_shared_article| new_articles << new_shared_article.build_new_article(self) }
end end
return [updated_article_pairs, outlisted_articles, new_articles] return [updated_article_pairs, outlisted_articles, new_articles]
end end