small optimizations

This commit is contained in:
Athou
2013-05-21 12:41:57 +02:00
parent a0c086de68
commit 23240f2c93
5 changed files with 21 additions and 18 deletions

View File

@@ -69,11 +69,13 @@ public class CategoryREST extends AbstractResourceREST {
@ApiParam(value = "limit for paging") @DefaultValue("-1") @QueryParam("limit") int limit,
@ApiParam(value = "date ordering", allowableValues = "asc,desc") @QueryParam("order") @DefaultValue("desc") ReadingOrder order) {
Preconditions.checkNotNull(id);
Preconditions.checkNotNull(readType);
Entries entries = new Entries();
boolean unreadOnly = readType == ReadType.unread;
if (StringUtils.isBlank(id)) {
id = ALL;
}
if (ALL.equals(id)) {
entries.setName("All");
@@ -125,7 +127,8 @@ public class CategoryREST extends AbstractResourceREST {
int offset = 0;
int limit = 20;
Entries entries = (Entries) getCategoryEntries(id, readType, offset, limit, order).getEntity();
Entries entries = (Entries) getCategoryEntries(id, readType, offset,
limit, order).getEntity();
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType("rss_2.0");
@@ -294,7 +297,7 @@ public class CategoryREST extends AbstractResourceREST {
@GET
@Path("/unreadCount")
@ApiOperation(value = "Get unread count for feed subscriptions", responseClass="List[com.commafeed.frontend.model.UnreadCount]")
@ApiOperation(value = "Get unread count for feed subscriptions", responseClass = "List[com.commafeed.frontend.model.UnreadCount]")
public Response getUnreadCount() {
List<UnreadCount> list = Lists.newArrayList();
Map<Long, Long> unreadCount = feedEntryStatusDAO

View File

@@ -59,12 +59,11 @@ public class PubSubHubbubCallbackREST {
log.info("confirmation callback received for {}", topic);
List<FeedPushInfo> infos = feedPushInfoDAO.findByTopic(topic);
List<FeedPushInfo> infos = feedPushInfoDAO.findByTopic(topic, false);
if (infos.isEmpty() == false) {
for (FeedPushInfo info : infos) {
log.info("activated push notifications for {}", info.getFeed()
.getUrl());
log.info("activated push notifications for {}", info.getTopic());
info.setActive(true);
}
feedPushInfoDAO.update(infos);
@@ -85,7 +84,8 @@ public class PubSubHubbubCallbackREST {
String topic = fetchedFeed.getTopic();
if (topic != null) {
log.info("content callback received for {}", topic);
List<FeedPushInfo> infos = feedPushInfoDAO.findByTopic(topic);
List<FeedPushInfo> infos = feedPushInfoDAO.findByTopic(topic,
true);
for (FeedPushInfo info : infos) {
Feed feed = info.getFeed();
log.info("pushing content to queue for {}", feed.getUrl());