xiangyu feng created FLINK-33698:
------------------------------------

             Summary: Fix the backoff time calculation in 
ExponentialBackoffDelayRetryStrategy
                 Key: FLINK-33698
                 URL: https://issues.apache.org/jira/browse/FLINK-33698
             Project: Flink
          Issue Type: Bug
          Components: API / DataStream
            Reporter: xiangyu feng


The backoff time calculation in `ExponentialBackoffDelayRetryStrategy` should 
consider currentAttempts. 

 

Current Version:
{code:java}
@Override
public long getBackoffTimeMillis(int currentAttempts) {
    if (currentAttempts <= 1) {
        // equivalent to initial delay
        return lastRetryDelay;
    }
    long backoff = Math.min((long) (lastRetryDelay * multiplier), 
maxRetryDelay);
    this.lastRetryDelay = backoff;
    return backoff;
} {code}
Fixed Version:
{code:java}
@Override
public long getBackoffTimeMillis(int currentAttempts) {
    if (currentAttempts <= 1) {
        // equivalent to initial delay
        return initialDelay;
    }
    long backoff =
            Math.min(
                    (long) (initialDelay * Math.pow(multiplier, currentAttempts 
- 1)),
                    maxRetryDelay);
    return backoff;
} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to