Sha256: 96ae83ca1dad85ef99d9d223b705d690253fdad6064bb468ce8f142c04ac5ca3

Contents?: true

Size: 451 Bytes

Versions: 20

Compression:

Stored size: 451 Bytes

Contents

require "timeout"

module Invoker
  class CLI::Pinger
    attr_accessor :unix_client
    def initialize(unix_client)
      @unix_client = unix_client
    end

    def invoker_running?
      response = send_ping_and_read_response
      response && response.status == 'pong'
    end

    private

    def send_ping_and_read_response
      Timeout.timeout(2) { unix_client.send_and_receive('ping') }
    rescue Timeout::Error
      nil
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
itrg-invoker-1.6.1 lib/invoker/cli/pinger.rb
itrg-invoker-1.6.0 lib/invoker/cli/pinger.rb
invoker-1.5.8 lib/invoker/cli/pinger.rb
invoker-1.5.7 lib/invoker/cli/pinger.rb
invoker-1.5.6 lib/invoker/cli/pinger.rb
invoker-1.5.5 lib/invoker/cli/pinger.rb
invoker-1.5.4 lib/invoker/cli/pinger.rb
invoker-1.5.3 lib/invoker/cli/pinger.rb
meepo-1.5.2 lib/invoker/cli/pinger.rb
invoker-1.5.1 lib/invoker/cli/pinger.rb
invoker-1.4.1 lib/invoker/cli/pinger.rb
invoker-1.4.0 lib/invoker/cli/pinger.rb
invoker-1.3.2 lib/invoker/cli/pinger.rb
invoker-1.3.1 lib/invoker/cli/pinger.rb
invoker-1.3.0 lib/invoker/cli/pinger.rb
invoker-1.2.0 lib/invoker/cli/pinger.rb
invoker-1.2.0.pre2 lib/invoker/cli/pinger.rb
invoker-1.2.0.pre1 lib/invoker/cli/pinger.rb
invoker-1.2.0.pre lib/invoker/cli/pinger.rb
invoker-1.1.0 lib/invoker/cli/pinger.rb