alexreisner/geocoder — pull request #480 by monfresh (2013-07-05 00:09:00+00:00)
Title: Add sleep option for geocode rake task.

While trying to geocode about 1700 addresses using Google's service, the rake task aborted with an `OverQueryLimitError` after geocoding between 20 and 35 addresses. To verify whether I had reached the 2500 requests/day limit, I dropped the db, flushed the redis cache, re-imported the non-geocoded data, then ran the rake task again. I was able to geocode 20 - 35 addresses once more. I was also able to make a request via my browser. This led me to believe I was hitting a per-second limit as opposed to the 2500 requests/day limit.

So I copied the rake task to my project, changed the namespace to avoid collisions, and added a sleep option to it. That solved the problem and I was able to geocode all the addresses without running into any limit errors. I tested this multiple times with varying amounts of addresses, and I hit the limit error every single time if I didn't add a sleep option. Adding a sleep timer worked every time. I first tried a value of 0.5, then tried 0.25, which worked too, so that's what I used in the README example.