diff options
author | Akihiko Odaki (@fn_aki@pawoo.net) <akihiko.odaki.4i@stu.hosei.ac.jp> | 2017-06-29 08:25:31 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-06-29 01:25:31 +0200 |
commit | f79c10162e51689f6759dfa39251c8ba8e7e11e8 (patch) | |
tree | 206a8cc91bcdaadf7450d97159cf6e7e3413d81f /app | |
parent | 60b2b56d380c7cd3dc0ba54f4650cfdba568e38e (diff) |
Use multiple pairs for zadd in PrecomputeFeedService (#3990)
Diffstat (limited to 'app')
-rw-r--r-- | app/services/precompute_feed_service.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/app/services/precompute_feed_service.rb b/app/services/precompute_feed_service.rb index 4c24567c8..e2f6ff0cb 100644 --- a/app/services/precompute_feed_service.rb +++ b/app/services/precompute_feed_service.rb @@ -13,21 +13,16 @@ class PrecomputeFeedService < BaseService attr_reader :account def populate_feed - redis.pipelined do - statuses.reverse_each do |status| - process_status(status) - end + pairs = statuses.reverse_each.map(&method(:process_status)) + redis.pipelined do + redis.zadd(account_home_key, pairs) redis.del("account:#{@account.id}:regeneration") end end def process_status(status) - add_status_to_feed(status) unless status_filtered?(status) - end - - def add_status_to_feed(status) - redis.zadd(account_home_key, status.id, status.reblog? ? status.reblog_of_id : status.id) + [status.id, status.reblog? ? status.reblog_of_id : status.id] unless status_filtered?(status) end def status_filtered?(status) |