mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
no longer fetch feeds without subscriptions
This commit is contained in:
@@ -29,13 +29,15 @@ public class FeedDAO extends GenericDAO<Feed> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Feed> findNextUpdatable(int count, Instant lastLoginThreshold) {
|
public List<Feed> findNextUpdatable(int count, Instant lastLoginThreshold) {
|
||||||
JPAQuery<Feed> query = query().selectFrom(FEED).where(FEED.disabledUntil.isNull().or(FEED.disabledUntil.lt(Instant.now())));
|
JPAQuery<Feed> query = query().selectFrom(FEED)
|
||||||
|
.distinct()
|
||||||
|
// join on subscriptions to only refresh feeds that have subscribers
|
||||||
|
.join(SUBSCRIPTION)
|
||||||
|
.on(SUBSCRIPTION.feed.eq(FEED))
|
||||||
|
.where(FEED.disabledUntil.isNull().or(FEED.disabledUntil.lt(Instant.now())));
|
||||||
|
|
||||||
if (lastLoginThreshold != null) {
|
if (lastLoginThreshold != null) {
|
||||||
query.where(JPAExpressions.selectOne()
|
query.join(SUBSCRIPTION.user).where(SUBSCRIPTION.user.lastLogin.gt(lastLoginThreshold));
|
||||||
.from(SUBSCRIPTION)
|
|
||||||
.join(SUBSCRIPTION.user)
|
|
||||||
.where(SUBSCRIPTION.feed.id.eq(FEED.id), SUBSCRIPTION.user.lastLogin.gt(lastLoginThreshold))
|
|
||||||
.exists());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return query.orderBy(FEED.disabledUntil.asc()).limit(count).fetch();
|
return query.orderBy(FEED.disabledUntil.asc()).limit(count).fetch();
|
||||||
|
|||||||
Reference in New Issue
Block a user