avoid an extra database roundtrip

This commit is contained in:
Athou
2013-04-14 18:12:35 +02:00
parent 874d7a4c07
commit 6217f236fa
2 changed files with 2 additions and 4 deletions

View File

@@ -106,8 +106,7 @@ public class FeedRefreshWorker {
transaction.begin(); transaction.begin();
if (fetchedFeed != null) { if (fetchedFeed != null) {
feedUpdateService.updateEntries(feed.getUrl(), feedUpdateService.updateEntries(feed, fetchedFeed.getEntries());
fetchedFeed.getEntries());
if (feed.getLink() == null) { if (feed.getLink() == null) {
feed.setLink(fetchedFeed.getLink()); feed.setLink(fetchedFeed.getLink());
} }

View File

@@ -36,8 +36,7 @@ public class FeedUpdateService {
@Inject @Inject
FeedEntryStatusDAO feedEntryStatusDAO; FeedEntryStatusDAO feedEntryStatusDAO;
public void updateEntries(String url, Collection<FeedEntry> entries) { public void updateEntries(Feed feed, Collection<FeedEntry> entries) {
Feed feed = feedDAO.findByUrl(url);
List<String> guids = Lists.newArrayList(); List<String> guids = Lists.newArrayList();
for (FeedEntry entry : entries) { for (FeedEntry entry : entries) {
guids.add(entry.getGuid()); guids.add(entry.getGuid());