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

Pass current time as a parameter in RedisTokenBucketManager #156

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

altso
Copy link
Contributor

@altso altso commented Feb 16, 2024

Fixes #154

@Namoshek
Copy link
Contributor

Overall, I think using an external timestamp for the script is fine. However, there is something I want to mention here.

One should keep in mind that in case of high latency between the application and Redis, using an external timestamp can cause inconsistencies due to different timestamps being seen by Redis. When Redis calculates the timestamp itself, then the time is a monotonic increasing integer. When the time comes from an external source, it can jump back and forth between requests to Redis when one application instance has a higher latency to Redis than the other or when there is congestion. Since Redis is super fast, this shouldn't matter in normal circumstances. It's just something one shouldn't rely on too much.

@cristipufu cristipufu merged commit e7715fd into cristipufu:master Feb 16, 2024
1 check 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.

RedisTokenBucketRateLimiter on AWS Serverless Redis Cache
3 participants