Permalink
Browse files

added retries

  • Loading branch information...
1 parent 75f761f commit 57dea5c6c0dc88175dd4ed9c5643e7d6ce0f4654 rkononov committed Jan 24, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/iron_worker/api.rb
View
@@ -166,7 +166,15 @@ def post(method, params={}, options={})
logger.debug 'body=' + json
req_hash = common_req_hash
req_hash[:body] = json
- response = @uber_client.post(url, req_hash)
+ begin
+ response = @uber_client.post(url, req_hash)
+ rescue Rest::Wrappers::TyphoeusTimeoutError => ex
+ retries ||= 0
+ retries += 1
+ logger.debug "Timed out retrying... #{retries}"
+ raise ex if retries >= 5
+ retry
+ end
#response = @http_sess.post(url, json, {"Content-Type" => 'application/json'})
check_response(response)
logger.debug 'response: ' + response.inspect

0 comments on commit 57dea5c

Please sign in to comment.