Sha256: 029aefcea4ab5df5039279fcce5e2f8cb1c0c4302d4dff01cdb27da44ff3f11d
Contents?: true
Size: 589 Bytes
Versions: 14
Compression:
Stored size: 589 Bytes
Contents
module LitmusPaper module Dependency class TCP def initialize(ip, port, options = {}) @ip, @port = ip, port @timeout = options.fetch(:timeout_seconds, 5) end def available? Timeout.timeout(@timeout) do socket = TCPSocket.new(@ip, @port) socket.close end true rescue Exception => e LitmusPaper.logger.info("TCP available check to #{@ip}:#{@port} failed with #{e.message}") false end def to_s "Dependency::TCP(tcp://#{@ip}:#{@port})" end end end end
Version data entries
14 entries across 14 versions & 1 rubygems