fastify / fastify-rate-limit

A low overhead rate limiter for your routes
MIT License
504 stars 71 forks source link

Added grouping routes for ratelimit #380

Closed aniketcodes closed 2 months ago

aniketcodes commented 2 months ago

This PR adds the capability to group various routes and have a common rate limit for them.

369

Checklist

mcollina commented 2 months ago

CI is failing

aniket-agi commented 2 months ago

Yeah... There is some issue with the coverage... I will update the test cases by today.

aniketcodes commented 2 months ago

Updated the testcases

aniketcodes commented 2 months ago
Screenshot 2024-09-04 at 22 41 06
aniketcodes commented 2 months ago

It is fixed. @gurgunday

aniketcodes commented 2 months ago

Hi @gurgunday / @mcollina Can you please help me with these? Am I missing something with the test?

aniketcodes commented 2 months ago

@gurgunday can you please run the CI again?

gurgunday commented 2 months ago

I’ll take a look if it’s passing on your end

aniketcodes commented 2 months ago

Hi @gurgunday Can you please run the CI again?

There was some issue with node_modules and c8. I have fixed them.

aniketcodes commented 2 months ago

Added it so that it is easily configurable across different route files.

aniketcodes commented 2 months ago

@gurgunday Will this implementation enhance the feature of grouping the routes without encapsulation?

gurgunday commented 2 months ago

I'm not sure, I feel like we're duplicating functionality and all these small additions might add up to slow down the rate limiter performance

@climba03003 @Uzlopak what do you think? Keep in mind https://github.com/fastify/fastify-rate-limit/pull/380#pullrequestreview-2281036104 already exists

gugu commented 2 months ago

I'm not sure, I feel like we're duplicating functionality and all these small additions might add up to slow down the rate limiter performance

We have a kind-of-common use case for it: we have several similar endpoints. Some of them should be used from frontend, some from backend and so on. If we use per-route rate limit some clever users start to use all similar endpoints to achieve their task and 50 rps becomes 300 rps