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 +4 -4
- data/lib/on_container/ops/service_connection_checks.rb +15 -4
- data/lib/on_container/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54acf33df99c8d0323a3a2878ac9072c31c7c4a2
|
4
|
+
data.tar.gz: a88bcc23ee64939e3c6b07456857d3e05e9fdc3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
25
|
-
|
26
|
-
|
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
|
data/lib/on_container/version.rb
CHANGED