Sha256: 6474a4a4fef7c094d2873df2e600b773642881f5289571f5b5ddd5256a378411
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
class PresenceChannelPublishJob < ApplicationJob queue_as :default def perform(obj_id, obj_class_name, serialized_state) serialized_state.symbolize_keys! channel_name = "presence-#{obj_class_name}#{obj_id}" channel_presence = ForeignOffice.bus.connection.channel_users(channel_name) if channel_presence[:users].any? ForeignOffice.publish( channel: channel_name, object: serialized_state ) else serialized_state[:foreign_office_retries] ||= 0 if serialized_state[:foreign_office_retries] < 4 # four total tries retry_wait = 2**serialized_state[:foreign_office_retries] serialized_state[:foreign_office_retries] += 1 PresenceChannelPublishJob.set(wait: retry_wait).perform_later(obj_id, obj_class_name, serialized_state) else failure_message = "PresenceChannelPublishJob: client never connected, not able to send" dont_raise = StandardError.new(failure_message) Bugsnag.notify(dont_raise) do |report| report.severity = 'error' report.add_tab(:presence_channel, obj_class_name: obj_class_name, obj_id: obj_id, serialized_state: serialized_state) end Rails.logger.error(failure_message) Rails.logger.error("PresenceChannelPublishJob: #{obj_class_name}: #{obj_id}: #{serialized_state}") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreign_office-0.17.0 | app/jobs/presence_channel_publish_job.rb |