diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4d4c63090..c5c2516f7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.397.1" + ".": "0.397.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fa354b12a..144ce70a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.397.2 (2026-01-16) + +Full Changelog: [v0.397.1...v0.397.2](https://github.com/Increase/increase-java/compare/v0.397.1...v0.397.2) + +### Bug Fixes + +* **client:** fully respect max retries ([9bfdc06](https://github.com/Increase/increase-java/commit/9bfdc0664a531b57b07a47aaa03a3dbc573b9e9d)) +* **client:** send retry count header for max retries 0 ([9bfdc06](https://github.com/Increase/increase-java/commit/9bfdc0664a531b57b07a47aaa03a3dbc573b9e9d)) + + +### Chores + +* **internal:** depend on packages directly in example ([9bfdc06](https://github.com/Increase/increase-java/commit/9bfdc0664a531b57b07a47aaa03a3dbc573b9e9d)) + ## 0.397.1 (2026-01-16) Full Changelog: [v0.397.0...v0.397.1](https://github.com/Increase/increase-java/compare/v0.397.0...v0.397.1) diff --git a/README.md b/README.md index 7c411b86a..83c9710cc 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.397.1) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.397.1/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.397.1) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.397.2) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.397.2/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.397.2) @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe -The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.397.1). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.397.2). @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ### Gradle ```kotlin -implementation("com.increase.api:increase-java:0.397.1") +implementation("com.increase.api:increase-java:0.397.2") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.397.1") com.increase.api increase-java - 0.397.1 + 0.397.2 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 450a8f4c4..d1fa88735 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.397.1" // x-release-please-version + version = "0.397.2" // x-release-please-version } subprojects { diff --git a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/OkHttpClient.kt b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/OkHttpClient.kt index dc73395b5..34e236429 100644 --- a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/OkHttpClient.kt +++ b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/OkHttpClient.kt @@ -230,6 +230,8 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien fun build(): OkHttpClient = OkHttpClient( okhttp3.OkHttpClient.Builder() + // `RetryingHttpClient` handles retries if the user enabled them. + .retryOnConnectionFailure(false) .connectTimeout(timeout.connect()) .readTimeout(timeout.read()) .writeTimeout(timeout.write()) diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt index 31bafe457..581b2b89b 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt @@ -31,10 +31,6 @@ private constructor( ) : HttpClient { override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { - if (!isRetryable(request) || maxRetries <= 0) { - return httpClient.execute(request, requestOptions) - } - var modifiedRequest = maybeAddIdempotencyHeader(request) // Don't send the current retry count in the headers if the caller set their own value. @@ -48,6 +44,10 @@ private constructor( modifiedRequest = setRetryCountHeader(modifiedRequest, retries) } + if (!isRetryable(modifiedRequest)) { + return httpClient.execute(modifiedRequest, requestOptions) + } + val response = try { val response = httpClient.execute(modifiedRequest, requestOptions) @@ -75,10 +75,6 @@ private constructor( request: HttpRequest, requestOptions: RequestOptions, ): CompletableFuture { - if (!isRetryable(request) || maxRetries <= 0) { - return httpClient.executeAsync(request, requestOptions) - } - val modifiedRequest = maybeAddIdempotencyHeader(request) // Don't send the current retry count in the headers if the caller set their own value. @@ -94,8 +90,12 @@ private constructor( val requestWithRetryCount = if (shouldSendRetryCount) setRetryCountHeader(request, retries) else request - return httpClient - .executeAsync(requestWithRetryCount, requestOptions) + val responseFuture = httpClient.executeAsync(requestWithRetryCount, requestOptions) + if (!isRetryable(requestWithRetryCount)) { + return responseFuture + } + + return responseFuture .handleAsync( fun( response: HttpResponse?,