Skip to content

Commit 5a2a634

Browse files
committed
Adds Custom limit
1 parent cac7f56 commit 5a2a634

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rate.go

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ func PerDay(rate int) Limit {
8080
}
8181
}
8282

83+
func Per(rate int, period time.Duration) Limit {
84+
return Limit{
85+
Rate: rate,
86+
Period: period,
87+
Burst: rate,
88+
}
89+
}
90+
8391
// ------------------------------------------------------------------------------
8492

8593
// Limiter controls how frequently events are allowed to happen.

0 commit comments

Comments
 (0)