brandur/redis-cell

Why Retry-After and Reset is the same?

molfar opened this issue · 1 comments

Should X-RateLimit-Reset response be number of seconds until maximum capacity of limit? If so, in my example it is always the same as Retry-After.

irb(main):004:0> 60.times { p redis.call('CL.THROTTLE', 'testkey', 0, 3, 60, 1); sleep 1 }
[0, 1, 0, -1, 20]
[1, 1, 0, 18, 18]
[1, 1, 0, 17, 17]
[1, 1, 0, 16, 16]
[1, 1, 0, 15, 15]
[1, 1, 0, 14, 14]
[1, 1, 0, 13, 13]
[1, 1, 0, 12, 12]
[1, 1, 0, 11, 11]
[1, 1, 0, 10, 10]
[1, 1, 0, 9, 9]
[1, 1, 0, 8, 8]
[1, 1, 0, 7, 7]
[1, 1, 0, 6, 6]
[1, 1, 0, 5, 5]
[1, 1, 0, 4, 4]
[1, 1, 0, 3, 3]
[1, 1, 0, 2, 2]
[1, 1, 0, 1, 1]
[1, 1, 0, 0, 0]
[0, 1, 0, -1, 20]
[1, 1, 0, 18, 18]
[1, 1, 0, 17, 17]
[1, 1, 0, 16, 16]
[1, 1, 0, 15, 15]
[1, 1, 0, 14, 14]
[1, 1, 0, 13, 13]
[1, 1, 0, 12, 12]
[1, 1, 0, 11, 11]
[1, 1, 0, 10, 10]
[1, 1, 0, 9, 9]
[1, 1, 0, 8, 8]
[1, 1, 0, 7, 7]
[1, 1, 0, 6, 6]
[1, 1, 0, 5, 5]
[1, 1, 0, 4, 4]
[1, 1, 0, 3, 3]
[1, 1, 0, 2, 2]
[1, 1, 0, 1, 1]
[1, 1, 0, 0, 0]
[0, 1, 0, -1, 20]
[1, 1, 0, 18, 18]
[1, 1, 0, 17, 17]
[1, 1, 0, 16, 16]
[1, 1, 0, 15, 15]
[1, 1, 0, 14, 14]
[1, 1, 0, 13, 13]
[1, 1, 0, 12, 12]
[1, 1, 0, 11, 11]
[1, 1, 0, 10, 10]
[1, 1, 0, 9, 9]
[1, 1, 0, 8, 8]
[1, 1, 0, 7, 7]
[1, 1, 0, 6, 6]
[1, 1, 0, 5, 5]
[1, 1, 0, 4, 4]
[1, 1, 0, 3, 3]
[1, 1, 0, 2, 2]
[1, 1, 0, 1, 1]
[1, 1, 0, 0, 0]
fxn commented

Maybe related, I am seeing headers like:

'X-Ratelimit-Reset': '46', 'Retry-After': '10'
'X-Ratelimit-Reset': '36', 'Retry-After': '0'

and in none of those cases Retry-After has a value that allows me to avoid a 429, I need to wait X-Ratelimit-Reset.