getDelayMillis

fun getDelayMillis(maxRetries: Int, remainingRetries: Int): Long

Calculate an exponential backoff delay before retrying the next completion request using the equation:

incrementSeconds ^ ((maxRetries - remainingRetries) + 1)

For example, if maxRetries is 3:

  • Delay 2 seconds before the first retry

  • Delay 4 seconds before the second retry

  • Delay 8 seconds before the third retry