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

feat: add support for weekly ratelimit unit #812

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/ratelimit/config/ratelimit/v3/rls_conf.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ enum RateLimitUnit {
// The time unit representing a day.
DAY = 4;

// The time unit representing a week.
WEEK = 7;

// The time unit representing a month.
MONTH = 5;

Expand Down
2 changes: 2 additions & 0 deletions src/utils/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func UnitToDivider(unit pb.RateLimitResponse_RateLimit_Unit) int64 {
return 60 * 60
case pb.RateLimitResponse_RateLimit_DAY:
return 60 * 60 * 24
case pb.RateLimitResponse_RateLimit_WEEK:
return 60 * 60 * 24 * 7
case pb.RateLimitResponse_RateLimit_MONTH:
return 60 * 60 * 24 * 30
case pb.RateLimitResponse_RateLimit_YEAR:
Expand Down
Loading