D
D
dron1122021-02-24 14:56:59
RESTful API
dron112, 2021-02-24 14:56:59

How to exceed the GitHub 2.0 API request limit?

I'm doing a test task, help with the implementation, I need an idea.

https://api.github.com/search/users?q={user_name }
There is a gitHub API that I use to request users, there is a form, I enter the user's login, submit, get to the server and output 10 users.

These 10 users have repositories that also need to be requested separately. I do this in the mounted method (I use vue.js) when users are mounted in the dom.

There is pagination when clicking on the next page, another 10 users and their repositories are requested.

PROBLEM
GitHub api has request limit ( https://docs.github.com/en/rest/overview/resources... )
After a few clicks on pagination, the limit ends and the application becomes inoperative.

SOLUTION
I save each response from the server with repositories in localStorage, which allows me to slightly stretch the life of the application, and if when clicking on pagination the repositories are in localStorage, then they are taken from there and a request to the server is not made

PROBLEM
The memory in localStorage runs out, after paging five pages with users, this is 50 repositories, the memory ends
(1 page = 10 users, 1 user = 1 request to the repositories)

QUESTION
What should I do to prevent the application from crashing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2021-02-24
@HemulGM

Restrictions need to be set. Count the number of requests and the time of the last request. If many requests have already been completed in the required time, then wait (hang up the application), or display a message.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question