Throttling outbound API calls generated by a Rails app

Posted by Sharpie on Stack Overflow See other posts from Stack Overflow or by Sharpie
Published on 2010-05-10T22:35:38Z Indexed on 2010/05/10 22:44 UTC
Read the original article Hit count: 317

Filed under:
|

I am not a professional web developer, but I like to wrench on websites as a hobby. Recently, I have been playing with developing a Rails app as a project to help me learn the framework. The goal of my toy app is to harvest data from another service through their API and make it available for me to query using a search function.

However, the service I want to pull data from imposes a rate limit on the number of API calls that may be executed per minute. I plan on having my app run a daily update which may generate a burst of API calls that far exceeds the limit provided by the external service. I wish to respect the performance of the external site and so would like to throttle the rate at which my app executes the calls.

I have done a little bit of searching and the overwhelming amount of tutorial material and pre-built libraries I have found cover throttling inbound API calls to a web app and I can find little discussion of controlling the flow of outbound calls.

Being both an amateur web developer and a rails newbie, it is entirely possible that I have been executing the wrong searches in the wrong places. Therefore my questions are:

  • Is there a nice website out there aggregating Rails tutorials that has material related to throttling outbound API requests?

  • Are there any ruby gems or other libraries that would help me throttle the requests?

I have some ideas of how I might go about writing a throttling system using a queue-based worker like DelayedJob or Resque to manage the API calls, but I would rather spend my weekends building the rest of the site if there is a good pre-built solution out there already.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about api