|
|
@ -45,9 +45,9 @@ class BatchedRemoveStatusService < BaseService
|
|
|
|
|
|
|
|
|
|
|
|
# Cannot be batched
|
|
|
|
# Cannot be batched
|
|
|
|
@status_id_cutoff = Mastodon::Snowflake.id_at(2.weeks.ago)
|
|
|
|
@status_id_cutoff = Mastodon::Snowflake.id_at(2.weeks.ago)
|
|
|
|
redis.pipelined do
|
|
|
|
redis.pipelined do |pipeline|
|
|
|
|
statuses.each do |status|
|
|
|
|
statuses.each do |status|
|
|
|
|
unpush_from_public_timelines(status)
|
|
|
|
unpush_from_public_timelines(status, pipeline)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -70,22 +70,22 @@ class BatchedRemoveStatusService < BaseService
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def unpush_from_public_timelines(status)
|
|
|
|
def unpush_from_public_timelines(status, pipeline)
|
|
|
|
return unless status.public_visibility? && status.id > @status_id_cutoff
|
|
|
|
return unless status.public_visibility? && status.id > @status_id_cutoff
|
|
|
|
|
|
|
|
|
|
|
|
payload = Oj.dump(event: :delete, payload: status.id.to_s)
|
|
|
|
payload = Oj.dump(event: :delete, payload: status.id.to_s)
|
|
|
|
|
|
|
|
|
|
|
|
redis.publish('timeline:public', payload)
|
|
|
|
pipeline.publish('timeline:public', payload)
|
|
|
|
redis.publish(status.local? ? 'timeline:public:local' : 'timeline:public:remote', payload)
|
|
|
|
pipeline.publish(status.local? ? 'timeline:public:local' : 'timeline:public:remote', payload)
|
|
|
|
|
|
|
|
|
|
|
|
if status.media_attachments.any?
|
|
|
|
if status.media_attachments.any?
|
|
|
|
redis.publish('timeline:public:media', payload)
|
|
|
|
pipeline.publish('timeline:public:media', payload)
|
|
|
|
redis.publish(status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', payload)
|
|
|
|
pipeline.publish(status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', payload)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
status.tags.map { |tag| tag.name.mb_chars.downcase }.each do |hashtag|
|
|
|
|
status.tags.map { |tag| tag.name.mb_chars.downcase }.each do |hashtag|
|
|
|
|
redis.publish("timeline:hashtag:#{hashtag}", payload)
|
|
|
|
pipeline.publish("timeline:hashtag:#{hashtag}", payload)
|
|
|
|
redis.publish("timeline:hashtag:#{hashtag}:local", payload) if status.local?
|
|
|
|
pipeline.publish("timeline:hashtag:#{hashtag}:local", payload) if status.local?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|