class Seatsio::HttpClient

def execute_with_retries(request_options)

def execute_with_retries(request_options)
  retry_count = 0
  while true
    begin
      return RestClient::Request.execute(request_options)
    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