Gets a delay based on the max retries and remaining retries
Returns the max duration if all retries are attempted.