on_container 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 047f95a8b1aa08140e835430767a983ba4f70e98
4
- data.tar.gz: 93bee7ffc095b037ebd8abf97ee87ee207643bdc
3
+ metadata.gz: 54acf33df99c8d0323a3a2878ac9072c31c7c4a2
4
+ data.tar.gz: a88bcc23ee64939e3c6b07456857d3e05e9fdc3e
5
5
  SHA512:
6
- metadata.gz: 416751bf09182242b57efad9b7c6224c137cb7e4ca065e69fd614836a1e0f90eef88f9df869484d175d120d232b7cdc332e3f32e54f9b76a16325b2a66f5d86e
7
- data.tar.gz: e556def5df06b70d854db1317b6471af52460d7535aa678e836dcda4695ec8028cbb9e884dec104369fe260d3d3fb68179f25ab07a459d6ebd3e45cf958aeb8f
6
+ metadata.gz: 4cf35805030790922726531669e44e90a425b83b9053215b4c8ea3d9dac8694e1b528b948471c21800bdc4eebf75e404cb6d2d46f50d8b7d0cbe9da6e4d0991e
7
+ data.tar.gz: 2e4a92754340093502d2f543fd465d980919cf24862aed26cab16199eeb063920968c509df77eada10cc4a65ec217700f45f854c86e4ab2e086f7d1c8d7656ae
@@ -12,6 +12,8 @@ module OnContainer
12
12
 
13
13
  Timeout::timeout(seconds_to_wait) do
14
14
  TCPSocket.new(uri.host, uri.port).close
15
+ rescue Errno::ECONNREFUSED
16
+ retry
15
17
  end
16
18
 
17
19
  true
@@ -21,10 +23,19 @@ module OnContainer
21
23
  end
22
24
 
23
25
  def wait_for_service_to_accept_connections(service_uri, seconds_to_wait = 30, exit_on_fail = true)
24
- return if service_accepts_connections?(service_uri, seconds_to_wait)
25
-
26
- exit 1 if exit_on_fail
26
+ wait_loop = Thread.new do
27
+ loop do
28
+ sleep(5)
29
+ puts "Waiting for #{service_uri} to accept connections..."
30
+ end
31
+ end
32
+
33
+ if service_accepts_connections?(service_uri, seconds_to_wait)
34
+ return wait_loop.exit
35
+ else
36
+ exit 1 if exit_on_fail
37
+ end
27
38
  end
28
39
  end
29
40
  end
30
- end
41
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnContainer
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla