-
Notifications
You must be signed in to change notification settings - Fork 4
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
API request improvements #5
Comments
Hey Yash, this looks interesting and I wanted to contribute I had some questions/thoughts about it.
What are your thoughts regarding this? |
Hi @louremipsum - Thanks for showing interest in this one. This is one of the really important fixes as too many API calls are happening as of now inside the hook 😅 The questions/thoughts you mentioned are really good. Sharing my responses for the same.
This is a valid point. We should make a list of categorised data items which needs/does not need caching. As caching unnecessary will increase the complexity as well. I have personally never worked with Caching, so I would you to lead this thread (will guide me as well) and we can continue with the fixes after that.
You're right. As of now, there's no rate-limiting applied to any method or API call. However, really important and good to have.
Again, a good point! As of now, there are no such pagination applied to the API calls. Only one method for fetching const {} = useGitHub({
username: "...",
personalAccessToken: "..."
});
const allRepos = getRepositories({
rowsPerPage: N // can be any number
}).all();
There are some applications of the GraphQL API in the code. For eg. fetching pinned repos. Would you like to describe on this one more? Great to see the questions coming, really helpful for the coding pattern for the next versions. TYSM! ✨ |
haha thanks for your thoughts
I have also worked on very simple caching(caching of Auth0 M2M token to reduce API calls to Auth0 directly) but it was a fairly simple usecase so maybe we can discuss thoughts and figure it out together? What to Cache vs What Not to CacheCache (Longer Duration)
Cache (Shorter Duration)
Do Not Cache (or Cache for Short Duration)
this can be a starting point for caching, should not have to be strictly this but up for further discussion
There is the rate limiting which Github does(primary and secondary) and further rate limiting which can be done using the github hook. Also would have to seriously treat the rate limit by Github since acc. to them they will ban if still req after ratelimit
Honestly was not sure about this one cause I didn't explore the whole repo as of now but this one of the things which I read before on GH blog that they are useful in combining multiple queries into one for fetching data so maybe(I'm kinda reaching and talking out loud) the hook can offer two options of either serving individual data via REST and if the user knows that they gonna need some set of data everytime then they can use the graphQL one to fetch multiple info in one request. |
Update: I have added the recurring meeting details for everyone - For all the upcoming Wednesdays and Fridays during the month of October. Please check the details too in the issue description for, |
I see how you're planning to lay the patterns for managing caches for different methods. As you have considerable experience with the same (caching and related things) Can we work on a POC for this one. A POC/DEV version for I would love to assign this one to you, and we can start working on building a POC that will focus on the following points,
Also, when starting to write the final update for this one, let's plan and break it into sub-features/fixes or PRs for better testing. |
Maybe I should make that component before testing and prepare/think about some performance metrics: on top of my head, I can think of Although I'm a bit busy rn now maybe I'll try to make it by Wednesday. Till that, if I find time, i will maybe research more on definite ways to improve performance. |
Both of the options you have mentioned, sounds good as a starting point. This will give devs more flexibility. We can include these patterns in the demo for testing.
Sounds promising, we can surely can continue with these 👍🏽
Sure, No hurries. Start whenever you're available 😊 We can keep updating this thread as we find and think of more solutions. Also, adding to the discussion. We can work on the API calls happening inside the hook. As of today, all the API calls (for user info, followers and following list, list of repos, list of pinned repos, etc) are happening at the time of hook initialisation. And this is surely not a good way and consumes a lot of tokens. As a solution, we can create getters for all the data retrieval functions. So that APIs are called only when there respective method is invoked. Can think more about how the coding pattern will look like. Thanks! |
As of the now, the number of API fetches happening inside the hook for all the methods i.e.
userInfo
,getRepositories
and their respective sub-methods - are really high.I have some ideas-as-solution to this issue, which will help reduce the API calls and improve overall dependency for all methods.
The text was updated successfully, but these errors were encountered: