merge push infos into feeds

This commit is contained in:
Athou
2013-06-05 21:50:26 +02:00
parent 7943c8e1e6
commit dbe7b48a04
9 changed files with 55 additions and 187 deletions

View File

@@ -28,7 +28,6 @@ import com.commafeed.backend.dao.FeedSubscriptionDAO;
import com.commafeed.backend.model.ApplicationSettings;
import com.commafeed.backend.model.Feed;
import com.commafeed.backend.model.FeedEntry;
import com.commafeed.backend.model.FeedPushInfo;
import com.commafeed.backend.model.FeedSubscription;
import com.commafeed.backend.pubsubhubbub.SubscriptionHandler;
import com.commafeed.backend.services.ApplicationSettingsService;
@@ -163,9 +162,8 @@ public class FeedRefreshUpdater {
}
private void handlePubSub(final Feed feed) {
FeedPushInfo info = feed.getPushInfo();
if (info != null) {
Date lastPing = info.getLastPing();
if (feed.getPushHub() != null && feed.getPushTopic() != null) {
Date lastPing = feed.getPushLastPing();
Date now = Calendar.getInstance().getTime();
if (lastPing == null || lastPing.before(DateUtils.addDays(now, -3))) {
new Thread() {

View File

@@ -15,9 +15,7 @@ import com.commafeed.backend.MetricsBean;
import com.commafeed.backend.dao.FeedEntryDAO;
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 {
@@ -37,9 +35,6 @@ public class FeedRefreshWorker {
@Inject
ApplicationSettingsService applicationSettingsService;
@Inject
FeedPushInfoService feedPushInfoService;
@Inject
MetricsBean metricsBean;
@@ -166,11 +161,8 @@ public class FeedRefreshWorker {
topic = "http://" + topic;
}
log.debug("feed {} has pubsub info: {}", feed.getUrl(), topic);
FeedPushInfo info = feed.getPushInfo();
if (info == null) {
info = feedPushInfoService.findOrCreate(feed, hub, topic);
}
feed.setPushInfo(info);
feed.setPushHub(hub);
feed.setPushTopic(topic);
}
}