No longer works on a lot of repositories (presumably > 10k commits)
paulie-g opened this issue · 1 comments
paulie-g commented
Describe the bug
Github returns 422 when GLOC queries for stats
To Reproduce
Steps to reproduce the behavior:
- Go to (https://github.com/paulie-g/redis-archive)
- Look at GLOC counter, it will say 'unavailable'
- Examine return code in dev tools
- It will say 422
Expected behavior
Number to be shown, 200 return code for stats query
Additional context
The github API docs for the stats/code_frequency endpoint now say:
Note: This endpoint can only be used for repositories with fewer than 10,000 commits. If the repository contains 10,000 or more commits, a 422 status code will be returned.
Presumably this is what's breaking GLOC? If it is, I can't think of a way around it using the current model.
paulie-g commented
Maybe detect a 422 and use this 3rd-party API when we can't use Github?
https://codetabs.com/count-loc/count-loc-online.html
It's got a 1 request/5 seconds rate limit, so maybe only use on individual repo page.