As I understand, when a message fails to be delivered, the Retry-After header is sometimes included in the response and sometimes not. But what happens if I first receives an error response with Retry-After included, resends the message and receives another error response but without Retry-After? I know I should use exponential backoff but how does that work when the previous waiting time was from the Retry-After header?
Imagine this sequence of requests and responses:
Request 1: No waiting
Response 1: Error without Retry-After
Request 2: Wait 2 seconds
Response 2: Error with Retry-After included (let's say 120 seconds)
Request 3: Wait 120 seconds
Response 3: Error without Retry-After
Request 4: How long should I wait?
How long should I wait before sending request 4? 8 seconds? Or start from the beginning with 2 seconds?