* Move Pusher Calls to sidekiq * CR changes Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
parent
91ace96acd
commit
f02d422b6a
2 changed files with 11 additions and 4 deletions
9
app/jobs/action_cable_broadcast_job.rb
Normal file
9
app/jobs/action_cable_broadcast_job.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class ActionCableBroadcastJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(members, event_name, data)
|
||||
members.each do |member|
|
||||
ActionCable.server.broadcast(member, event: event_name, data: data)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -45,9 +45,7 @@ class ActionCableListener < BaseListener
|
|||
def send_to_members(members, event_name, data)
|
||||
return if members.blank?
|
||||
|
||||
members.each do |member|
|
||||
ActionCable.server.broadcast(member, event: event_name, data: data)
|
||||
end
|
||||
::ActionCableBroadcastJob.perform_later(members, event_name, data)
|
||||
end
|
||||
|
||||
def send_to_contact(contact, event_name, message)
|
||||
|
@ -55,7 +53,7 @@ class ActionCableListener < BaseListener
|
|||
return if message.activity?
|
||||
return if contact.nil?
|
||||
|
||||
ActionCable.server.broadcast(contact.pubsub_token, event: event_name, data: message.push_event_data)
|
||||
::ActionCableBroadcastJob.perform_later([contact.pubsub_token], event_name, message.push_event_data)
|
||||
end
|
||||
|
||||
def push(pubsub_token, data)
|
||||
|
|
Loading…
Reference in a new issue