While I think I already know what that is, I would still like to be 100% sure.
What I’m asking is:
- is every website visit a request
- is every API call (with python, when you do a get/post request and then, it returns JSON) a request
- and is there anything else connected to the rate limits?
Thank you for your time!
A rate limit is considered when the Glitch reverse-proxy have to open a new HTTP request to your container and hits a certain rate per unit and get limited. If you have a lot of resources on your server (like images or styles) I recommend you create a service worker on your website to cache those resources. If you use custom domains and cloudflare you can also make cloudflare cache those resources.
If you have an API that will get a lot of requests I suggest moving your request to using web sockets hence websockets opens a keep alive http connection, which means that each message will use the same http connection as the one it used to connect.
But also, don’t go crazy trying to avoid rate limits. I think we often forget that 4,000 requests per hour is a lot: even if one visit to your website loads 10 files, that’s six visitors per minute, every minute.
Having that many visitors is a good problem to have :) and at that point, it might be worth paying Glitch a couple bucks a month for all that they do for us
Adding service workers or cloudflare caching wouldn’t be about avoiding ratelimits, however a better and faster experience for the end user. Adding a service worker would increase the load time of a website by a lot.
True! I just shy away from service workers because it’s easy to over-cache, and end up with stale content or a website that you have to visit twice in order for content to update
Hahah, I understand that one! Although once you get a little experienced with web workers they’re not so frightening anymore. There are many ways to update file content in the background without the user knowing. I can probably write a guide for that sometime
Oh also, is there a way to see, how many requests left each hour?
Not already made, although in express you can make a connect plugin to count the requests coming in per hour and manually calculate the outcome.
Oh, I’m wondering if there’s a way for python.
Also, are those requests calculated for each exact hour?
For example: 4PM-5PM (and not something like 4:16PM-5:16PM)
I suspect that this is something @glitch_support is aware of.
I really hope they do it the same way Let’s Encrypt rate limits the creation of certificates, i.e. based upon a timeline with the amount of requests from now and one hour ago.