calabash-cucumber 0.9.85 → 0.9.86
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/calabash-cucumber/core.rb +13 -12
- data/lib/calabash-cucumber/version.rb +1 -1
- metadata +1 -1
@@ -351,23 +351,24 @@ module Calabash
|
|
351
351
|
|
352
352
|
def make_http_request(url, req)
|
353
353
|
body = nil
|
354
|
-
|
355
|
-
|
354
|
+
CAL_HTTP_RETRY_COUNT.times do |count|
|
355
|
+
begin
|
356
356
|
if not (@http) or not (@http.started?)
|
357
357
|
@http = init_request(url)
|
358
358
|
@http.start
|
359
359
|
end
|
360
360
|
body = @http.request(req).body
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
361
|
+
break
|
362
|
+
rescue Errno::ECONNRESET, EOFError, Errno::ECONNREFUSED => e
|
363
|
+
if count < CAL_HTTP_RETRY_COUNT-1
|
364
|
+
puts "Retrying.. (#{e})"
|
365
|
+
sleep(0.3)
|
366
|
+
else
|
367
|
+
puts "Failing..."
|
368
|
+
raise e
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
371
372
|
|
372
373
|
body
|
373
374
|
end
|