go-chi / httprate

net/http rate limiter middleware
MIT License
270 stars 18 forks source link

O(n) operation done on every counter increment #7

Closed puzpuzpuz closed 3 years ago

puzpuzpuz commented 3 years ago

c.lastEvict field used to amortize the cost of local counter's eviction doesn't seem to be ever updated.

pkieltyka commented 3 years ago

thanks for the note. its been fixed in https://github.com/go-chi/httprate/commit/60179e626a4fcb0bd4f0b82cb26f5aa1cb5758ce and tagged version v0.5.2