Add stop streaming config
This commit is contained in:
parent
c47f85eddf
commit
f5332b0654
10 changed files with 19 additions and 9 deletions
29
app/workers/delivery_emoji_reaction_worker.rb
Normal file
29
app/workers/delivery_emoji_reaction_worker.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DeliveryEmojiReactionWorker
|
||||
include Sidekiq::Worker
|
||||
include Redisable
|
||||
include Lockable
|
||||
include AccountLimitable
|
||||
|
||||
def perform(payload_json, status_id, my_account_id = nil)
|
||||
redis.publish("timeline:#{my_account_id}", payload_json) if my_account_id.present?
|
||||
|
||||
status = Status.find(status_id.to_i)
|
||||
|
||||
if status.present?
|
||||
scope_status(status).where.not(stop_emoji_reaction_streaming: true).find_each do |account|
|
||||
redis.publish("timeline:#{account.id}", payload_json) if redis.exists?("subscribed:timeline:#{account.id}")
|
||||
end
|
||||
|
||||
if !([:public, :unlisted, :public_unlisted].include?(status.visibility.to_sym)) && status.account_id != my_account_id &&
|
||||
redis.exists?("subscribed:timeline:#{status.account_id}")
|
||||
redis.publish("timeline:#{status.account_id}", payload_json)
|
||||
end
|
||||
end
|
||||
|
||||
true
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue