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

Reducing API Hits And Adding In Failsafes For If Hit API Limit #114

Open
matthewcn56 opened this issue May 6, 2022 · 0 comments
Open

Reducing API Hits And Adding In Failsafes For If Hit API Limit #114

matthewcn56 opened this issue May 6, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@matthewcn56
Copy link
Member

Within OpenSource, calling the getProjects function hits the API about 3-4 times each minute due to the way that revalidation works and the fact that getProjects uses paginate which wraps multiple api calls in one if there are more than 100 repositories within ACM.

Inside the main page of index.tsx, the only place that we use a project is to randomly feature a project, and there's no need for us to hit the getProjects function there. Instead, I propose that we store a couple projects that we want to highlight inside a JSON array, and randomly choose from that list as opposed to from the entire list of acm's projects.

Some projects that we can initially highlight are Cyber's CTF Platform, TeachLA's Editor, and Hack's HOTH website.

To get their info to put into the JSON array, you can call the github api to grab that data to put into the array!

Additionally, something that we want to do is to add in failsafes for if the Octokit API goes past the rate limit. Maybe we can use the repository fixtures as a failsafe if we hit the API rate limit as opposed to simply having the website crash?

Within the projects page, we prob don't need to revalidate the projects every 60 seconds, we can prob change the revalidate to be done daily! For the index.tsx, we can keep it as revalidate 60 for events but we no longer want to call the getProjects() function which does multiple hits to our endpoint.

The way that revalidation works is that it revalidates ALL the props associated with the page every interval. If you want to read more about it, you can check it out within the revalidate link I provided up above!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment