mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
merge push infos into feeds
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user