mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-23 13:05:12 +01:00
Use multiple pairs for zadd in PrecomputeFeedService (#3990)
This commit is contained in:
parent
60b2b56d38
commit
f79c10162e
@ -13,21 +13,16 @@ class PrecomputeFeedService < BaseService
|
|||||||
attr_reader :account
|
attr_reader :account
|
||||||
|
|
||||||
def populate_feed
|
def populate_feed
|
||||||
redis.pipelined do
|
pairs = statuses.reverse_each.map(&method(:process_status))
|
||||||
statuses.reverse_each do |status|
|
|
||||||
process_status(status)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
redis.pipelined do
|
||||||
|
redis.zadd(account_home_key, pairs)
|
||||||
redis.del("account:#{@account.id}:regeneration")
|
redis.del("account:#{@account.id}:regeneration")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_status(status)
|
def process_status(status)
|
||||||
add_status_to_feed(status) unless status_filtered?(status)
|
[status.id, status.reblog? ? status.reblog_of_id : status.id] 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)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_filtered?(status)
|
def status_filtered?(status)
|
||||||
|
Loading…
Reference in New Issue
Block a user