diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-08 02:08:32 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-08 02:08:32 +0100 |
commit | bb4d1eb2e86ec6227c18df29ce0f0f25ae2f6ee3 (patch) | |
tree | e0230cf6dc1913631aa333cc1b0724dfcc9863aa /app/services | |
parent | 096bfbad966e7dbd0ea2d71b12d1f411daabdb72 (diff) |
Improve feed regeneration
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/fan_out_on_write_service.rb | 2 | ||||
-rw-r--r-- | app/services/precompute_feed_service.rb | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 674665592..4f8777a50 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -33,7 +33,7 @@ class FanOutOnWriteService < BaseService status.mentions.includes(:account).each do |mention| mentioned_account = mention.account - next if !mentioned_account.local? || mentioned_account.id == status.account_id || FeedManager.instance.filter?(:mentions, status, mentioned_account) + next if !mentioned_account.local? || FeedManager.instance.filter?(:mentions, status, mentioned_account) FeedManager.instance.push(:mentions, mentioned_account, status) end end diff --git a/app/services/precompute_feed_service.rb b/app/services/precompute_feed_service.rb index eb5f48575..3094c50fd 100644 --- a/app/services/precompute_feed_service.rb +++ b/app/services/precompute_feed_service.rb @@ -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 |