sethvargo / go-limiter

A supersonic rate limiting package for Go with HTTP middleware.
Apache License 2.0
555 stars 40 forks source link

X-RateLimit-Reset time is incorrect in 0.7.0 #27

Closed alexreid closed 3 years ago

alexreid commented 3 years ago

In v0.7.0, the date and time calculated for X-RateLimit-Reset is incorrect. Rather than a value relative to the current time, it's a value a shortly after the Unix epoch:

0.6.0: X-RateLimit-Reset: Fri, 10 Sep 2021 15:23:06 UTC

0.7.0: X-RateLimit-Reset: Fri, 02 Jan 1970 13:24:25 UTC

This seems to be because the timestamp being returned from fasttime.Now() does not represent the current time, which seems to be due to the switch to runtime.nanotime instead of runtime.walltime. I'm seeing this behaviour on Go 1.17 darwin/amd64.

alexreid commented 3 years ago

I can confirm that’s fixed now with time.now, thank you!

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.