Commit 213d5862 authored by 2458773093's avatar 2458773093

fan out to group members

parent c8ce87e4
......@@ -28,4 +28,10 @@ module GroupInteractions
end
end
def accounts_for_local_distribution
accounts.local
.joins(:user)
.where('users.current_sign_in_at > ?', User::ACTIVE_DURATION.ago)
end
end
......@@ -46,6 +46,16 @@ class FanOutOnWriteService < BaseService
end
end
def deliver_to_group_members(status)
Rails.logger.debug "Delivering status #{status.id} to group members #{status.group.id}"
status.group.accounts_for_local_distribution.select(:id).reorder(nil).find_in_batches do |members|
FeedInsertWorker.push_bulk(members) do |member|
[status.id, member.id, :home]
end
end
end
def deliver_to_lists(status)
Rails.logger.debug "Delivering status #{status.id} to lists"
......@@ -62,6 +72,8 @@ class FanOutOnWriteService < BaseService
Rails.logger.debug "Delivering status #{status.id} to group"
Redis.current.publish("timeline:group:#{status.group_id}", @payload)
deliver_to_group_members(status)
end
def deliver_to_mentioned_followers(status)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment