Sha256: 82338d40357da2fa315fee3876c728d6eef6fa3400ce727e1d24c09976baa79f
Contents?: true
Size: 429 Bytes
Versions: 12
Compression:
Stored size: 429 Bytes
Contents
require 'timeout' require 'socket' class TCPSocket def self.wait_for_service(options) socket = nil Timeout::timeout(options[:timeout] || 20) do loop do begin socket = TCPSocket.new(options[:host], options[:port]) return rescue Errno::ECONNREFUSED puts ".\n" sleep 2 end end end ensure socket.close unless socket.nil? end end
Version data entries
12 entries across 12 versions & 2 rubygems