Skip to content

Commit

Permalink
support empty limit settings
Browse files Browse the repository at this point in the history
  • Loading branch information
n0str committed Jan 21, 2025
1 parent 8bbd0af commit 81f2825
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/redis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ func (r *RedisClient) CheckAvailability() bool {

// UpdateRateLimit checks and updates the rate limit for a project
func (r *RedisClient) UpdateRateLimit(projectID string, eventsLimit int64, eventsPeriod int64) (bool, error) {
// If eventsLimit is 0, we don't need to update the rate limit
if eventsLimit == 0 {
return true, nil
}

// Key format: "project_id" -> "timestamp:count"
now := time.Now().Unix()

Expand Down

0 comments on commit 81f2825

Please sign in to comment.