fastify / fastify-rate-limit

A low overhead rate limiter for your routes
MIT License
477 stars 66 forks source link

Add function support for timeWindow #357

Closed mindrunner closed 7 months ago

mindrunner commented 7 months ago

This update allows timeWindow to be a function that can dynamically determine the time window based on the request and key. The code refactor has been applied across both the Redis and Local stores. Tests for this new functionality have been added to ensure correctness. The TypeScript definition was also updated to reflect this change.

https://github.com/fastify/fastify-rate-limit/issues/283

Checklist

mindrunner commented 7 months ago

Could you update the tests for the types?

done

gurgunday commented 7 months ago

@mindrunner can you try targeting next?

mindrunner commented 7 months ago

@mindrunner can you try targeting next?

done

gurgunday commented 7 months ago

Thanks again for the PR