On 02/12/2014 08:12 AM, Lukáš Doktor wrote:
> Hi guys,
> 
> some of you were on the Monday's meeting, where discussion raised a
> request for automatic pull request checker and next generator. I took a
> look on it and implemented very basic version just to see, whether it's
> worth it. Please note that some parts are hardcoded to my setup.

FYI: I don't see any "speed-control" happening in this code.  Github
currently limits you to 5000 requests per hour.  However due to the way
some results are provided, it's hard to predict how many 'requests' a
certain operation will consume.  Fortunately, checking the limits and
reset/time is 'free' (github.rate_limiting &
github.rate_limiting_resettime).

A naive approach is to assume this is the only API app running against
your account, then simply delay around 0.7 seconds per operation.  A
slightly more sophisticated approach is to monitor the actual change in
requests remaining for the hour, and delay to not exceed that.  Either
way, aggressively caching the 'raw_data' + 'headers' attributes and
using github.create_from_raw_data() can extend the rate limits much
further w/o requiring all the delays.

-- 
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to