Sha256: 72d707024bcc2265853771bf4e8a62b394cbe49e1cba6efc16de973bde968273

Contents?: true

Size: 363 Bytes

Versions: 18

Compression:

Stored size: 363 Bytes

Contents

# frozen_string_literal: true

module Kafka
  class Heartbeat
    def initialize(group:, interval:)
      @group = group
      @interval = interval
      @last_heartbeat = Time.now
    end

    def trigger!
      @group.heartbeat
      @last_heartbeat = Time.now
    end

    def trigger
      trigger! if Time.now > @last_heartbeat + @interval
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ruby-kafka-0.7.4 lib/kafka/heartbeat.rb
ruby-kafka-0.7.3 lib/kafka/heartbeat.rb
ruby-kafka-0.7.2 lib/kafka/heartbeat.rb
ruby-kafka-0.7.1.debugcorruption2 lib/kafka/heartbeat.rb
ruby-kafka-0.7.1.messagecorruptiondebug lib/kafka/heartbeat.rb
ruby-kafka-0.7.1 lib/kafka/heartbeat.rb
ruby-kafka-0.7.1.beta2 lib/kafka/heartbeat.rb
ruby-kafka-0.7.1.possible.pre.fetch.pre.fix lib/kafka/heartbeat.rb
ruby-kafka-0.7.1.beta1 lib/kafka/heartbeat.rb
ruby-kafka-0.7.0 lib/kafka/heartbeat.rb
ruby-kafka-0.6.8 lib/kafka/heartbeat.rb
ruby-kafka-0.7.0.beta2 lib/kafka/heartbeat.rb
ruby-kafka-0.7.0.beta1 lib/kafka/heartbeat.rb
ruby-kafka-0.7.0.alpha4 lib/kafka/heartbeat.rb
ruby-kafka-0.6.7 lib/kafka/heartbeat.rb
ruby-kafka-0.6.6 lib/kafka/heartbeat.rb
ruby-kafka-0.6.5 lib/kafka/heartbeat.rb
ruby-kafka-0.6.4 lib/kafka/heartbeat.rb