I have been struggling to understand the logic behind Yii2's value for X-Rate-Limit-Reset
header that is calculated in this line.
The documentation states:
X-Rate-Limit-Reset, the number of seconds to wait in order to get the maximum number of allowed requests
So, if the rate limit is 100 and the time period/window is 3600 seconds, then I understand it should work like this:
- Request #1 at 10:00 returns with header
X-Rate-Limit-Reset 3599
- Request #2 at 10:30 returns with header
X-Rate-Limit-Reset 1800
- Request #3 at 10:59 returns with header
X-Rate-Limit-Reset 59
Am I misunderstanding something? Or is this a bug?