fleet 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fleet.rb +1 -11
- metadata +1 -1
data/lib/fleet.rb
CHANGED
@@ -18,7 +18,7 @@ class Fleet
|
|
18
18
|
|
19
19
|
def query(q)
|
20
20
|
request = @json_encoder.encode(q)
|
21
|
-
response =
|
21
|
+
response = write_and_read(request)
|
22
22
|
status, value = @json_parser.parse(response)
|
23
23
|
case status
|
24
24
|
when 0
|
@@ -57,16 +57,6 @@ class Fleet
|
|
57
57
|
@socket = nil
|
58
58
|
end
|
59
59
|
|
60
|
-
def write_and_read_with_retry(request)
|
61
|
-
begin
|
62
|
-
write_and_read(request)
|
63
|
-
rescue Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED, Timeout::Error
|
64
|
-
disconnect
|
65
|
-
connect
|
66
|
-
write_and_read(request)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
60
|
def write_and_read(request)
|
71
61
|
with_timeout do
|
72
62
|
@socket.write(request)
|