getDelay

open override fun getDelay(maxRetries: Int, remainingRetries: Int): Duration

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

incrementDuration ^ ((maxRetries - remainingRetries) + 1)

For example, if maxRetries is 3 and incrementDuration is 2 seconds:

  • Delay 2 seconds before the first retry

  • Delay 4 seconds before the second retry

  • Delay 8 seconds before the third retry