Sha256: 8ffc953a5c81bff40790affc9138d3d0eff3f8cf484fbaa5a0f46ddea5414f59

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

module Telephony
  module Jobs
    class AgentOffline
      attr_accessor :id, :timestamp

      def initialize id, timestamp
        @id = id
        @timestamp = timestamp
      end

      def update_status
        Agent.find_with_lock(id) do |agent|
          agent.update_status_by_event Agent::OFFLINE, timestamp
        end
      end

      def perform
        update_status
      end

      def failure
        Rails.logger.error "#{self.class}: #{self.as_json}"
        ActiveSupport::Notifications
          .instrument("telephony.agent_offline_failure", self)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telephony-1.0.4 lib/telephony/jobs/agent_offline.rb
telephony-1.0.3 lib/telephony/jobs/agent_offline.rb