restore a version of findNextUpdatable that handles inactive users better than the one we removed a while ago

This commit is contained in:
Athou
2023-06-16 15:27:39 +02:00
parent 4a90e1f69d
commit c835d805b1
2 changed files with 17 additions and 7 deletions

View File

@@ -168,7 +168,10 @@ public class FeedRefreshEngine implements Managed {
private List<Feed> getNextUpdatableFeeds(int max) {
return unitOfWork.call(() -> {
List<Feed> feeds = feedDAO.findNextUpdatable(max);
Date lastLoginThreshold = Boolean.TRUE.equals(config.getApplicationSettings().getHeavyLoad())
? DateUtils.addDays(new Date(), -30)
: null;
List<Feed> feeds = feedDAO.findNextUpdatable(max, lastLoginThreshold);
// update disabledUntil to prevent feeds from being returned again by feedDAO.findNextUpdatable()
Date nextUpdateDate = DateUtils.addMinutes(new Date(), config.getApplicationSettings().getRefreshIntervalMinutes());
feedDAO.setDisabledUntil(feeds.stream().map(AbstractModel::getId).collect(Collectors.toList()), nextUpdateDate);