http: Don't add rate limit entries for things that aren't limited
This commit is contained in:
parent
549958270c
commit
0c8c34d81d
@ -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 {
|
func (this *Handler) rateLimit (req *http.Request, resource string, duration time.Duration) error {
|
||||||
|
if duration == 0 { return nil }
|
||||||
host, _, _ := net.SplitHostPort(req.RemoteAddr)
|
host, _, _ := net.SplitHostPort(req.RemoteAddr)
|
||||||
key := fmt.Sprintf("%s|%s", host, resource)
|
key := fmt.Sprintf("%s|%s", host, resource)
|
||||||
table, done := this.rateLimitMap.Borrow()
|
table, done := this.rateLimitMap.Borrow()
|
||||||
|
Loading…
Reference in New Issue
Block a user