mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
small optimizations
This commit is contained in:
@@ -13,11 +13,13 @@ import com.commafeed.backend.model.FeedPushInfo_;
|
||||
@Stateless
|
||||
public class FeedPushInfoDAO extends GenericDAO<FeedPushInfo> {
|
||||
|
||||
public List<FeedPushInfo> findByTopic(String topic) {
|
||||
public List<FeedPushInfo> findByTopic(String topic, boolean includeFeed) {
|
||||
|
||||
CriteriaQuery<FeedPushInfo> query = builder.createQuery(getType());
|
||||
Root<FeedPushInfo> root = query.from(getType());
|
||||
root.fetch(FeedPushInfo_.feed);
|
||||
if (includeFeed) {
|
||||
root.fetch(FeedPushInfo_.feed);
|
||||
}
|
||||
query.where(builder.equal(root.get(FeedPushInfo_.topic), topic));
|
||||
|
||||
TypedQuery<FeedPushInfo> q = em.createQuery(query);
|
||||
|
||||
@@ -47,10 +47,15 @@ public class FeedRefreshUpdater {
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePubSub(Feed feed) {
|
||||
private void handlePubSub(final Feed feed) {
|
||||
FeedPushInfo info = feed.getPushInfo();
|
||||
if (info != null && info.isActive() == false) {
|
||||
handler.subscribe(feed);
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
handler.subscribe(feed);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,6 @@ package com.commafeed.backend.pubsubhubbub;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Asynchronous;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.TransactionAttribute;
|
||||
import javax.ejb.TransactionAttributeType;
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
@@ -25,8 +21,6 @@ import com.commafeed.backend.model.FeedPushInfo;
|
||||
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@Stateless
|
||||
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
|
||||
public class SubscriptionHandler {
|
||||
|
||||
private static Logger log = LoggerFactory
|
||||
@@ -35,7 +29,6 @@ public class SubscriptionHandler {
|
||||
@Inject
|
||||
ApplicationSettingsService applicationSettingsService;
|
||||
|
||||
@Asynchronous
|
||||
public void subscribe(Feed feed) {
|
||||
FeedPushInfo info = feed.getPushInfo();
|
||||
String hub = info.getHub();
|
||||
|
||||
Reference in New Issue
Block a user