Closed gurgunday closed 10 months ago
I really had to think about it and I think it is the correct way.
Imagining following case:
You have 1.9 seconds left. Math.floor would return 1 and means in 1 second you can make your next request. You make your next request in 1 second and get 0.9 as the internal value and get again a 429 error. But with Math.ceil we get for 1.9 seconds the value 2 and you would do the next request in 2 seconds and dont get the 429 error.
Last (small) breaking change, promise 😁
Here's the case for it: it changes nothing on our side, but sending an endpoint
Retry-After: 0
is arguably worse than sendingRetry-After: 1
when they still have 900ms of blockageAlso, the whole idea of sending
Retry-After: 0
makes no senseAnd finally, all tests that contained checks against multiple values have been modified