Skip to content

fix(DynamoDB): return null for expired keys in get() method#341

Merged
animir merged 1 commit intoanimir:masterfrom
anasdevv:master
Dec 13, 2025
Merged

fix(DynamoDB): return null for expired keys in get() method#341
animir merged 1 commit intoanimir:masterfrom
anasdevv:master

Conversation

@anasdevv
Copy link
Copy Markdown
Contributor

Description

Fixes #310

The get() method in RateLimiterDynamo was returning expired items instead of null. DynamoDB's TTL cleanup can take up to 48 hours, so the library must validate expiration timestamps client-side.

Problem

The _get() method checked if an item exists but never validated the expire timestamp, causing:

  • Rate limits to persist beyond their intended duration

Solution

Added expiration validation in _get():

  • Return null if item.expire <= currentTime
  • Treat -1 as never-expiring (unchanged)

@animir
Copy link
Copy Markdown
Owner

animir commented Dec 13, 2025

Clear and straightforward. Thanks!

@animir animir merged commit 2cc65d7 into animir:master Dec 13, 2025
8 of 14 checks passed
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.

DynamoDB TTL Experience: "get" method must return null when item has expired

2 participants