Comments (12)
The issue with looping and summing up is the performance, since each graphql request takes time. So I'm finding any other solutions to fetch total commits.
We can use commit search API to get this in single request: https://developer.github.com/v3/search/#search-commits it has a total_count
field.
e.g.
curl -H "Accept: application/vnd.github.cloak-preview" https://api.github.com/search/commits\?q\=author:adamyi
but it has a rate limit of 30 queries per minute. It's probably fine for self-hosted instances with cache, but not with the public instance
from github-readme-stats.
What if the label is modified to avoid such confusion? Only until there is a viable fix to the issue.
For eg. "Total commits(2020)" or "Last year commits"
from github-readme-stats.
@preyansh98 yes that's what is suggested in this comment by @kingthorin #15 (comment)
Also note that it's not just about the performance delay, since this is running on free vercel serverless function each request would only have 10seconds to get executed before eventually failing, and 10seconds might seem like a lot but actually its surprisingly small, i have tried it with kentcdodds' profile and the request barely misses the 10second mark finishing in 9seconds
from github-readme-stats.
from github-readme-stats.
A single repo of mine https://github.com/rampatra/Algorithms-and-Data-Structures-in-Java has 230+ commits but the card only shows 108 commits in total. The repo is public too.
btw @rampatra one thing to note is that the total commit count is not "total commits you made so far since you joined github" its "total commits this year so far"
from github-readme-stats.
@anuraghazra yes, I noticed this in issues you linked to this ticket. But can't we request the GitHub API in a loop asking for 4-5 years of commits (1 year in each iteration) and then sum up all to get the total?
from github-readme-stats.
That's what I did in #15
from github-readme-stats.
Ah, I see. So, what's next? Is this going to be merged? Or, would you be just changing the label text to "This year's commits"?
from github-readme-stats.
The issue with looping and summing up is the performance, since each graphql request takes time. So I'm finding any other solutions to fetch total commits.
from github-readme-stats.
@anuraghazra
Great work with this!
Is it possible to enable total commits as not the default behavior but maybe as an option in the API?
Maybe another parameter in the request like /?findTotalCommits=true that when passed in will trigger this heavy work? I assume it'll be cached in impl too.
Suggesting this so it doesn't break current API performance, it can just be an additional "experimental" option for those that don't mind the performance delay. What do you think?
from github-readme-stats.
@adamyi Yeah i think this would actually work! i'm trying to see if i could do it with GraphQL api otherwise i would just do the RESTfull version then
from github-readme-stats.
Fixed in #211
from github-readme-stats.
Related Issues (20)
- Different shell color in `Wakatime Stats` and `GitHub Most Used Language`.
- `Most Used Lang` Showing Wrong Output
- Add an option to display byte count for Top-languages HOT 7
- The submission of private warehouses cannot be calculated HOT 2
- Could not resolve to a User with the login of 'gungunsaluja'. HOT 1
- Discrepancy in Total Commits Count for 2024 HOT 1
- Wakatime leaderboards stats HOT 3
- Top Languages Card having issues with picture and source elements for light and dark mode
- Revisiting gist langs
- Commit Count Inaccuracies for Authored and Committed Commits in GitHub Profile Stats
- Private Repository HOT 3
- Inaccurate streak count HOT 5
- Top Langs error (theme=react)
- Streak only tracks to January 1st HOT 2
- Option to include a category for repos without a recognized language on languages card
- GitHub Infer Colourscheme
- Align HOT 3
- Width BUG HOT 4
- Bug in Calculating the Top Langs HOT 1
- Github readme-stats takes too long to update
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github-readme-stats.