add generic and auth rate limiting to ntg

This commit is contained in:
Bel LaPointe
2022-01-11 22:56:03 -05:00
parent e546034c26
commit b54be3c32c
2 changed files with 8 additions and 2 deletions

View File

@@ -6,7 +6,11 @@ import (
"golang.org/x/time/rate"
)
var limiter = rate.NewLimiter(rate.Limit(0.3), 1)
// once per minute
var authlimiter = rate.NewLimiter(rate.Limit(1.0/60.0), 1)
// thrice per minute
var limiter = rate.NewLimiter(rate.Limit(1.0/20.0), 1)
type Broker interface {
Search([]config.State) ([]Job, error)