Sha256: a0f651530b274e37306143bd29145b140eb9789b583f504143e4133d4ee384ca

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

module QPush
  module Server
    # The Heartbeat worker periodically updates the heart namespace.
    # The key is set with an expiry. This helps to indicate if the QPush server
    # is currently active.
    #
    class Heartbeat
      def initialize
        @done = false
      end

      # Starts our perform process. This will run until instructed to stop.
      #
      def start
        until @done
          QPush.redis.with { |c| c.setex(QPush.keys.heart, 30, true) }
          sleep 15
        end
      end

      # Shutsdown our heartbeat process.
      #
      def shutdown
        @done = true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qpush-0.1.4 lib/qpush/server/heartbeat.rb