Giter Site home page Giter Site logo

Comments (12)

adamyi avatar adamyi commented on May 21, 2024 6

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.

maddyb99 avatar maddyb99 commented on May 21, 2024 2

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.

anuraghazra avatar anuraghazra commented on May 21, 2024 1

@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.

anuraghazra avatar anuraghazra commented on May 21, 2024

related to #14 #15

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 21, 2024

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.

rampatra avatar rampatra commented on May 21, 2024

@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.

anuraghazra avatar anuraghazra commented on May 21, 2024

That's what I did in #15

from github-readme-stats.

rampatra avatar rampatra commented on May 21, 2024

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.

anuraghazra avatar anuraghazra commented on May 21, 2024

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.

preyansh98 avatar preyansh98 commented on May 21, 2024

@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.

anuraghazra avatar anuraghazra commented on May 21, 2024

@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.

anuraghazra avatar anuraghazra commented on May 21, 2024

Fixed in #211

from github-readme-stats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.