Skip to content

Commit

Permalink
Adds Custom limit
Browse files Browse the repository at this point in the history
  • Loading branch information
irania9O committed Jun 9, 2024
1 parent cac7f56 commit 5a2a634
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ func PerDay(rate int) Limit {
}
}

func Per(rate int, period time.Duration) Limit {
return Limit{
Rate: rate,
Period: period,
Burst: rate,
}
}

// ------------------------------------------------------------------------------

// Limiter controls how frequently events are allowed to happen.
Expand Down

0 comments on commit 5a2a634

Please sign in to comment.