Skip to content
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

RateLimiterDynamo: Add key to skip querying ttl #278

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

ollyfg
Copy link
Contributor

@ollyfg ollyfg commented Sep 27, 2024

TLDR: Adds an option allowing users to skip the check for TTL settings when using the RateLimiterDynamo.

When assessing this library for use in a serverless environment (in this case AWS Lambda), we noticed that there was a significant overhead every time we instantiated a new rate limiter (so every time a new lambda started). This was due to RateLimiterDynamo's behaviour which is to query the table to make sure that the TTL has been set up correctly.

While this is useful behavior on a long-running server, it doesn't make much sense in a serverless environment - once we've validated that the TTL is indeed set up correctly it doesn't make sense to keep checking it again and again and again.

I propose a new option which disables this check, in much the same way that you can disable RateLimiterDynamo's built-in table-creation logic.

@animir
Copy link
Owner

animir commented Oct 20, 2024

@ollyfg Hello, thank you! This looks great.
FYI, I'll add a new type for ttlSet attribute to index.d.ts.

@animir animir merged commit dfb296f into animir:master Oct 20, 2024
7 checks passed
@animir
Copy link
Owner

animir commented Oct 20, 2024

Released in v 5.0.4.

@animir
Copy link
Owner

animir commented Oct 20, 2024

@ollyfg I've added a new option description here https://github.com/animir/node-rate-limiter-flexible/wiki/Options#ttlset
Please, let me know if you think it is good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants