actions-runner-controller/github
Yusuke Kuoka 4c53e3aa75 Add GitHub API cache to avoid rate limit
This will cache any GitHub API responses with correct Cache-Control header.

`gregjones/httpcache` has been chosen as a library to implement this feature, as it is as recommended in `go-github`'s documentation:

https://github.com/google/go-github#conditional-requests

`gregjones/httpcache` supports a number of cache backends like `diskcache`, `s3cache`, and so on:

https://github.com/gregjones/httpcache#cache-backends

We stick to the built-in in-memory cache as a starter. Probably this will never becomes an issue as long as various HTTP responses for all the GitHub API calls that ARC makes, list-runners, list-workflow-jobs, list-runner-groups, etc., doesn't overflow the in-memory cache.

`httpcache` has an known unfixed issue that it doesn't update cache on chunked responses. But we assume that the APIs that we call doesn't use chunked responses. See #1503 for more information on that.

Ref #920
2022-02-19 12:22:53 +00:00
..
fake Update go-github from v37 -> v39 (#925) 2021-12-11 21:43:40 +09:00
metrics Add metrics for GitHub API rate limit (#312) 2021-02-16 09:58:09 +09:00
github.go Add GitHub API cache to avoid rate limit 2022-02-19 12:22:53 +00:00
github_test.go Update go-github from v37 -> v39 (#925) 2021-12-11 21:43:40 +09:00