prevent duplicate entries for push infos

This commit is contained in:
Athou
2013-05-22 11:25:29 +02:00
parent cafcfc4c9f
commit eff84c69af
2 changed files with 45 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ import com.commafeed.backend.model.Feed;
import com.commafeed.backend.model.FeedEntry;
import com.commafeed.backend.model.FeedPushInfo;
import com.commafeed.backend.services.ApplicationSettingsService;
import com.commafeed.backend.services.FeedPushInfoService;
import com.sun.syndication.io.FeedException;
public class FeedRefreshWorker {
@@ -35,6 +36,9 @@ public class FeedRefreshWorker {
@Inject
ApplicationSettingsService applicationSettingsService;
@Inject
FeedPushInfoService feedPushInfoService;
public void start(MutableBoolean running, String threadName) {
log.info("{} starting", threadName);
@@ -132,7 +136,7 @@ public class FeedRefreshWorker {
log.debug("feed {} has pubsub info: {}", feed.getUrl(), topic);
FeedPushInfo info = feed.getPushInfo();
if (info == null) {
info = new FeedPushInfo();
info = feedPushInfoService.findOrCreate(feed, hub, topic);
}
if (!StringUtils.equals(hub, info.getHub())
|| !StringUtils.equals(topic, info.getTopic())) {