long get()

in common/src/main/java/org/apache/cassandra/diff/ExponentialRetryStrategyProvider.java [97:108]


        long get(int attempts) {
            long nextMaybe = baseDelayMs << attempts; // Do not care about overflow. pausedInTotal() corrects the value
            if (attempts == 0) { // first retry
                return nextMaybe;
            } else {
                long pausedInTotal = pausedInTotal(attempts);
                if (pausedInTotal < totalDelayMs) {
                    return Math.min(totalDelayMs - pausedInTotal, nextMaybe); // adjust the next pause time if possible
                }
                return -1; // the previous retries have exhausted the permits
            }
        }