Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache the GitHub API response for 1 hour #20

Closed
kinow opened this issue Aug 28, 2019 · 1 comment · Fixed by #23
Closed

Cache the GitHub API response for 1 hour #20

kinow opened this issue Aug 28, 2019 · 1 comment · Fixed by #23
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@kinow
Copy link
Member

kinow commented Aug 28, 2019

We are hitting the GitHub API every time the page is reloaded. NIWA has ~700 employees, and out of these a few must be accessing the website (less than 50 I'd say), but with the same IP address.

It has happened in the past, and again right now, that GitHub API stopped working for us due to rate limit. I suspect the same might happen in other sites - #19 & #15

Setting an API for GitHub with better rate limit is an option, but not easy to deploy securely to GitHub pages I guess.

Another possibility is actually cache the returned value for 1 hour in the local storage, which gets persisted in the user's browser (it's easy to use, and really fast/simple, but not ideal for sensitive data).

This would reduce the amount of requests sent to GitHub, and avoid us being blocked again 🤞

@kinow kinow added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Aug 28, 2019
@kinow
Copy link
Member Author

kinow commented Aug 28, 2019

Low priority, and am working on an annoying webpack issue in Cylc UI, so won't work on this for a while.

But if anybody is interested, this would involve basic JS, without any framework. And would require probably a) some use of promise/async (or callbacks), b) use the LocalStorage JS API, c) testing that it works with shorter periods.

So an interesting little issue to skill up some JS 🆙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant