yast/yast-meta — pull request #10 by roman-neuhauser (2014-03-24 14:35:34+00:00)
Title: get_repos observes 304 Not Modified

a step towards offline operation, get_repos keeps repository listings
on disk, issues http requests with If-None-Match using the ETag from
the cached data, and reuses said data when github says 304 Not Modified.

while it's not offline-capable yet it's way faster than the previous
impl which always did 5 curl requests for each of yast, libyui.
(with per_page=100, even though there's just 163 repos in yast/ and
11 in libyui.)

it's faster because the common case is just two requests, one for each
github org, both resulting in 304 and short-circuiting the fetching
right there.

it's also not as prone to running into github's throttling of api
requests (60 per ip address per hour), which i managed to run into
at home.

BTW, i'm not sure if it's appropriate to short-circuit the fetching
on the first 304 response: does github invalidate all ETags when
a single page in the listing changes?