mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
feat: User pagination using offsets (#1062)
Offset pagination and cursor pagination supported
This commit is contained in:
@ -13,6 +13,12 @@ import (
|
||||
// RateLimitPerMinute returns a handler that limits requests per-minute based
|
||||
// on IP, endpoint, and user ID (if available).
|
||||
func RateLimitPerMinute(count int) func(http.Handler) http.Handler {
|
||||
// -1 is no rate limit
|
||||
if count <= 0 {
|
||||
return func(handler http.Handler) http.Handler {
|
||||
return handler
|
||||
}
|
||||
}
|
||||
return httprate.Limit(
|
||||
count,
|
||||
1*time.Minute,
|
||||
|
Reference in New Issue
Block a user