http: Don't add rate limit entries for things that aren't limited

This commit is contained in:
Sasha Koshka 2024-12-26 23:37:54 -05:00
parent 549958270c
commit 0c8c34d81d

View File

@ -337,6 +337,7 @@ func (this *Handler) logErr (name string, err error) {
}
func (this *Handler) rateLimit (req *http.Request, resource string, duration time.Duration) error {
if duration == 0 { return nil }
host, _, _ := net.SplitHostPort(req.RemoteAddr)
key := fmt.Sprintf("%s|%s", host, resource)
table, done := this.rateLimitMap.Borrow()