-
-
Notifications
You must be signed in to change notification settings - Fork 787
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
Streak Card not fetching in Readme file #601
Comments
When there is a lot of traffic to the Heroku server, the GitHub API seems to stop sending back content and the responses become very slow. If it takes too long to load, GitHub will just show a broken image instead of waiting. GitHub also caches responses on their server, so even if the speed gets back to normal, it could still show as broken on GitHub for a particular image URL for up to a few hours. To avoid this issue, I recommend self-hosting the project. There are steps in the readme, I recently added a new method for deploying with Vercel entirely online. It's free and shouldn't take more than a couple minutes to set up. It should also start working on its own, but there isn't much I can do to prevent it from going down in the future, so self-hosting is still an option to get it to stay up more reliably. |
@DenverCoder1 why not set up caching on the backend? Instead of calling the GitHub API on every request, you can cache a user's stats for a few hours and have it clear itself automatically, that way the number of calls do the GitHub API should reduce dramatically. Yes, the PNG won't pick up your new streak immediately until the cache invalidates, but this should be much better than GitHub showing a broken image. Considering how lightweight and simple this project is, I don't think you'd even have to use Redis or something similar for caching, just a regular hashmap and it should work fine (unless you're running multiple instances on the heroku server that is). |
Thanks for the suggestions, @XiovV. I believe that GitHub is caching the images, but even with that, the server is overloaded with new requests. We have cache control headers set to tell servers to use cached versions for up to an hour. Maybe increasing this to be a few hours could help. Only 1 instance is running on Heroku (using a Basic dyno formation). There is no persistent storage, but an external service could be used for caching if necessary, though. |
Describe the bug
When I used GitHub's Streak URL in browser it was showing the streak card but when I had put it in ReadMe file it showed alternate text and link. May be due to the loading time of this API call as it always takes more than 20 seconds or sometimes failed to load and reflect application error.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Using this https://streak-stats.demolab.com/?user=keshav-chandra&theme=calm link SVG or PNG, it should have shown the below result.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: