fun withRetry()

in teamcity-rest-client-impl/src/main/kotlin/org/jetbrains/teamcity/rest/builder.kt [111:125]


    fun withRetry(
        maxAttempts: Int,
        initialDelay: Long,
        maxDelay: Long,
        delayTimeUnit: TimeUnit
    ): TeamCityInstanceBuilder {
        require(maxAttempts > 0) { "At least one attempt must be configured" }
        require(initialDelay >= 0) { "Retry delay cannot be negative" }
        require(maxDelay >= initialDelay) { "Delay limit (maxDelay) bust be greater or equal to the initial delay" }

        retryMaxAttempts = maxAttempts
        retryInitialDelayMs = delayTimeUnit.toMillis(initialDelay)
        retryMaxDelayMs = delayTimeUnit.toMillis(maxDelay)
        return this
    }