Sha256: 526d18f67520fc21d45d2a6dc371dc77cb52a8da916bd5a8b43948688ea6de3a

Contents?: true

Size: 783 Bytes

Versions: 6

Compression:

Stored size: 783 Bytes

Contents

module AtomicSidekiq
  module Heartbeat
    def self.included(base)
      base.send :include, InstanceMethods
    end

    module InstanceMethods
      def heartbeat!(timeout = nil)
        heartbeat_operation.perform(
          jid: jid,
          timeout: timeout || default_heartbeat_timeout
        )
      end

      private

      def default_heartbeat_timeout
        AtomicSidekiq::AtomicFetch::DEFAULT_EXPIRATION_TIME
      end

      def heartbeat_operation
        @heartbeat_operation ||= AtomicSidekiq::AtomicOperation::Heartbeat.new(
          in_flight_keymaker: keymaker
        )
      end

      def keymaker
        @keymaker ||= AtomicSidekiq::InFlightKeymaker.new(
          AtomicSidekiq::AtomicFetch::IN_FLIGHT_KEY_PREFIX
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
atomic-sidekiq-1.3.0 lib/atomic_sidekiq/heartbeat.rb
atomic-sidekiq-1.2.0 lib/atomic_sidekiq/heartbeat.rb
atomic-sidekiq-1.1.4 lib/atomic_sidekiq/heartbeat.rb
atomic-sidekiq-1.1.3 lib/atomic_sidekiq/heartbeat.rb
atomic-sidekiq-1.1.2 lib/atomic_sidekiq/heartbeat.rb
atomic-sidekiq-1.1.0 lib/atomic_sidekiq/heartbeat.rb