Re:Tollbooth: HTTP rate limiter middleware in Go
by mackross on Friday May 22, 2015 @12:54PM
(#9589527)
It looks to me like the map of rate buckets will grow unbounded and never be cleaned up?
[ Parent
| on HN ]
Re:Tollbooth: HTTP rate limiter middleware in Go
by kellros on Friday May 22, 2015 @04:34PM
(#9590785)
Looks to be the case based on the config. I'm suprised storage wasn't abstracted to accommodate redis or the like which is essential in a load balanced scenario.
The API doesn't seem quite idiomatic either, I'd expect to create a struct containing options and a function that closes over the http.Handler interface e.g. func(l *Limiter) Limit(next http.Handler) http.Handler or a function that takes options and a next http.Handler that creates a struct implementing http.Handler.