thecity/thecity-admin-ruby — pull request #4 by chrismo (2012-12-26 16:28:08+00:00)
Title: Added Pacemaker module.

[submitting a pull request for your review, but prolly don't think
this is worthwhile as-is].

The Pacemaker module is one approach to allowing a long running script
to pace itself according to API rate limits. It's a bit coarse and after
using it some, there doesn't seem to be much advantage to pacing the
final few calls across the remaining minutes of the hour vs. just one
big sleep at the end, but I still wanted to keep the experiment.

To properly decide if pacing the calls throughout the hour is
worthwhile, the total number of calls would need to be fed to the
calculation. Pacing all the time is a waste if there will be less calls
in the hour than the limit remaining.

In addition, if there will be more calls than the limit remaining, then
choosing to pace versus one long wait once the limit is exhausted
results in the same amount of time waiting, so there seems to be little
advantage to pacing at all.