Skip to content

Commit 4fcd0fc

Browse files
release: 0.14.1 (#161)
* chore: add max retries to test (#160) * fix(client): async streaming flakiness (#162) * chore(internal): fix release (#163) * release: 0.14.1 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 29b5d11 commit 4fcd0fc

File tree

6 files changed

+48
-8
lines changed

6 files changed

+48
-8
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.14.0"
2+
".": "0.14.1"
33
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 0.14.1 (2025-01-25)
4+
5+
Full Changelog: [v0.14.0...v0.14.1](https://github.com/openai/openai-java/compare/v0.14.0...v0.14.1)
6+
7+
### Bug Fixes
8+
9+
* **client:** async streaming flakiness ([#162](https://github.com/openai/openai-java/issues/162)) ([247c05a](https://github.com/openai/openai-java/commit/247c05a70fecad0bc1498d5aa56e13310f36eb96))
10+
11+
12+
### Chores
13+
14+
* add max retries to test ([#160](https://github.com/openai/openai-java/issues/160)) ([7c4a4e0](https://github.com/openai/openai-java/commit/7c4a4e034c5edaea804435972f558df6a9326220))
15+
* **internal:** fix release ([#163](https://github.com/openai/openai-java/issues/163)) ([987fa44](https://github.com/openai/openai-java/commit/987fa4409a86636bbe87fee77522a1659e263f3b))
16+
317
## 0.14.0 (2025-01-24)
418

519
Full Changelog: [v0.13.0...v0.14.0](https://github.com/openai/openai-java/compare/v0.13.0...v0.14.0)

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
1010
<!-- x-release-please-start-version -->
1111

12-
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.14.0)
13-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.14.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.14.0)
12+
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.14.1)
13+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.14.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.14.1)
1414

1515
<!-- x-release-please-end -->
1616

@@ -25,7 +25,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
2525
### Gradle
2626

2727
```kotlin
28-
implementation("com.openai:openai-java:0.14.0")
28+
implementation("com.openai:openai-java:0.14.1")
2929
```
3030

3131
### Maven
@@ -34,7 +34,7 @@ implementation("com.openai:openai-java:0.14.0")
3434
<dependency>
3535
<groupId>com.openai</groupId>
3636
<artifactId>openai-java</artifactId>
37-
<version>0.14.0</version>
37+
<version>0.14.1</version>
3838
</dependency>
3939
```
4040

build.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ repositories {
88

99
allprojects {
1010
group = "com.openai"
11-
version = "0.14.0" // x-release-please-version
11+
version = "0.14.1" // x-release-please-version
1212
}
1313

1414
subprojects {
1515
apply(plugin = "org.jetbrains.dokka")
1616
}
17+
18+
// Avoid race conditions between `dokkaJavadocCollector` and `dokkaJavadocJar` tasks
19+
tasks.named("dokkaJavadocCollector").configure {
20+
subprojects.flatMap { it.tasks }
21+
.filter { it.project.name != "openai-java" && it.name == "dokkaJavadocJar" }
22+
.forEach { mustRunAfter(it) }
23+
}

openai-java-core/src/main/kotlin/com/openai/core/http/PhantomReachableClosingAsyncStreamResponse.kt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.openai.core.http
22

33
import com.openai.core.closeWhenPhantomReachable
44
import com.openai.core.http.AsyncStreamResponse.Handler
5+
import java.util.Optional
56
import java.util.concurrent.Executor
67

78
internal class PhantomReachableClosingAsyncStreamResponse<T>(
@@ -12,13 +13,30 @@ internal class PhantomReachableClosingAsyncStreamResponse<T>(
1213
}
1314

1415
override fun subscribe(handler: Handler<T>): AsyncStreamResponse<T> = apply {
15-
asyncStreamResponse.subscribe(handler)
16+
asyncStreamResponse.subscribe(HandlerReferencingAsyncStreamResponse(handler, this))
1617
}
1718

1819
override fun subscribe(handler: Handler<T>, executor: Executor): AsyncStreamResponse<T> =
1920
apply {
20-
asyncStreamResponse.subscribe(handler, executor)
21+
asyncStreamResponse.subscribe(
22+
HandlerReferencingAsyncStreamResponse(handler, this),
23+
executor
24+
)
2125
}
2226

2327
override fun close() = asyncStreamResponse.close()
2428
}
29+
30+
/**
31+
* A wrapper around a `Handler` that also references an `AsyncStreamResponse` so that the latter
32+
* will not only be phantom reachable and get reclaimed early while the handler itself is reachable
33+
* and subscribed to the response.
34+
*/
35+
private class HandlerReferencingAsyncStreamResponse<T>(
36+
private val handler: Handler<T>,
37+
private val asyncStreamResponse: AsyncStreamResponse<T>
38+
) : Handler<T> {
39+
override fun onNext(value: T) = handler.onNext(value)
40+
41+
override fun onComplete(error: Optional<Throwable>) = handler.onComplete(error)
42+
}

openai-java-core/src/test/kotlin/com/openai/core/http/RetryingHttpClientTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ internal class RetryingHttpClientTest {
4545
val retryingClient =
4646
RetryingHttpClient.builder()
4747
.httpClient(httpClient)
48+
.maxRetries(2)
4849
.idempotencyHeader("X-Some-Header")
4950
.build()
5051
val response = retryingClient.execute(request)

0 commit comments

Comments
 (0)