Module: Pact::WaitUntilServerAvailable
- Included in:
- ProviderVerifier::App
- Defined in:
- lib/pact/wait_until_server_available.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(host, port, wait_time = 15) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pact/wait_until_server_available.rb', line 6 def self.call(host, port, wait_time = 15) end_time = Time.now + wait_time tries = 0 begin sleep 2 if tries != 0 Socket.tcp(host, port, connect_timeout: 3) {} true rescue => e tries += 1 retry if Time.now < end_time return false end end |
Instance Method Details
#wait_until_server_available(*args) ⇒ Object
20 21 22 |
# File 'lib/pact/wait_until_server_available.rb', line 20 def wait_until_server_available *args WaitUntilServerAvailable.call(*args) end |