Improve feed regeneration
This commit is contained in:
parent
096bfbad96
commit
bb4d1eb2e8
5 changed files with 15 additions and 11 deletions
|
@ -2,17 +2,13 @@ class PrecomputeFeedService < BaseService
|
|||
# Fill up a user's home/mentions feed from DB and return a subset
|
||||
# @param [Symbol] type :home or :mentions
|
||||
# @param [Account] account
|
||||
# @return [Array]
|
||||
def call(type, account, limit)
|
||||
def call(type, account)
|
||||
instant_return = []
|
||||
|
||||
Status.send("as_#{type}_timeline", account).order('id desc').limit(FeedManager::MAX_ITEMS).find_each do |status|
|
||||
Status.send("as_#{type}_timeline", account).limit(FeedManager::MAX_ITEMS).each do |status|
|
||||
next if FeedManager.instance.filter?(type, status, account)
|
||||
redis.zadd(FeedManager.instance.key(type, account.id), status.id, status.id)
|
||||
instant_return << status unless instant_return.size > limit
|
||||
redis.zadd(FeedManager.instance.key(type, account.id), status.id, status.reblog? ? status.reblog_of_id : status.id)
|
||||
end
|
||||
|
||||
instant_return
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue