Git Product home page Git Product logo

Comments (3)

DenverCoder1 avatar DenverCoder1 commented on August 16, 2024 13

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.

from github-readme-streak-stats.

XiovV avatar XiovV commented on August 16, 2024 3

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

from github-readme-streak-stats.

DenverCoder1 avatar DenverCoder1 commented on August 16, 2024

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.

from github-readme-streak-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.