Skip to content

fix(client): release owned HTTP resources - #106

Closed
GregHolmes wants to merge 10 commits into
mainfrom
gh/add-client-lifecycle
Closed

GregHolmes wants to merge 10 commits into
mainfrom
gh/add-client-lifecycle

Conversation

@GregHolmes

@GregHolmes GregHolmes commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • make DeepgramClient and AsyncDeepgramClient AutoCloseable
  • release the dispatcher and connection pool only when the SDK created the OkHttpClient
  • preserve caller ownership when .httpClient(...) supplies the client
  • make every streaming disconnect() terminal and safe before, during, and after connection setup
  • synchronize connection teardown, cancellation, and socket publication so no late socket survives cleanup
  • complete in-flight connect() futures exceptionally when teardown wins the handshake race
  • close all streaming example resources on success and failure paths
  • document ordered parent-client and WebSocket cleanup with try-with-resources

Validation

  • ./gradlew spotlessCheck test compileExamples --rerun-tasks
  • Manual production Flux probe: connected a Listen v2 socket, disconnected it, then closed the parent client. The child JVM exited in 772 ms.

Closes #104

@GregHolmes

Copy link
Copy Markdown
Collaborator Author

Superseded by #108, which keeps the ownership-aware client lifecycle fix focused. Generated WebSocket teardown races and streaming-sample cleanup are tracked separately in #107.

@GregHolmes GregHolmes closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Provide explicit lifecycle management for shared OkHttp resources

1 participant