Method: Seatsio::HttpClient#execute_with_retries
- Defined in:
- lib/seatsio/httpClient.rb
#execute_with_retries(request_options) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/seatsio/httpClient.rb', line 53 def execute_with_retries() retry_count = 0 while true begin return RestClient::Request.execute() rescue RestClient::ExceptionWithResponse => e if e.response.code != 429 || retry_count >= @max_retries raise e else wait_time = (2 ** (retry_count + 2)) / 10.0 sleep(wait_time) retry_count += 1 end end end end |