diff options
author | David Yip <yipdw@member.fsf.org> | 2017-10-16 09:27:01 -0500 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-10-16 09:27:01 -0500 |
commit | 7e9d93472c72c7d13373597c3efcec39145f50a2 (patch) | |
tree | c1f29f0794905492cfa279da68fa86970f2a583e /app | |
parent | dbb1fce94dbd877d795898933ca344359f9b74c1 (diff) | |
parent | 7cc71748cecfa6cb35bc53e656df39d6f9219ae2 (diff) |
Merge remote-tracking branch 'upstream/master' into gs-master
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/feed_manager.rb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 1bbaad4cc..e93c49bb1 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -100,11 +100,24 @@ class FeedManager end def populate_feed(account) - prepopulate_limit = FeedManager::MAX_ITEMS / 4 - statuses = Status.as_home_timeline(account).order(account_id: :desc).limit(prepopulate_limit) - statuses.reverse_each do |status| - next if filter_from_home?(status, account) - add_to_feed(:home, account, status) + added = 0 + limit = FeedManager::MAX_ITEMS / 2 + max_id = nil + + loop do + statuses = Status.as_home_timeline(account) + .paginate_by_max_id(limit, max_id) + + break if statuses.empty? + + statuses.each do |status| + next if filter_from_home?(status, account) + added += 1 if add_to_feed(:home, account, status) + end + + break unless added.zero? + + max_id = statuses.last.id end end |