Skip to content

Commit

Permalink
feat: add support for weekly ratelimit unit (#812)
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Sedich <stefan.sedich@gmail.com>
  • Loading branch information
stefansedich authored Jan 11, 2025
1 parent 87adad2 commit fccc165
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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

0 comments on commit fccc165

Please sign in to comment.