How best to handle rate limiting/throttling

Skip to first unread message

James McKinney

Sep 28, 2013, 5:19:33 PM9/28/13
I search this group and the issue queue, but I could not find a discussion.

Let's say I queue a bunch of requests to an API and then run the queue. At some point, I hit the rate limit and the server no longer responds with a 200 HTTP code. I would like to be able to have Typhoeus stop sending requests after it receives that first bad response. What is the best way to do it? Raising an exception inside a request's #on_complete when a rate limit is exceeded does the trick. Curious to hear if anyone has considered other alternatives. The following gist has sample code using plain Typhoeus and Typhoeus with Faraday.



Hans Hasselberg

Sep 28, 2013, 6:12:14 PM9/28/13
Hi James,

you can use hydra.abort: This will clear the queued instances and won't execute any subsequent requests.

You received this message because you are subscribed to the Google Groups "Typhoeus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Reply all
Reply to author
0 new messages