feat: replace onReconnect with onTransportRestore#10
Merged
maxence2997 merged 6 commits intomainfrom Mar 24, 2026
Merged
Conversation
1.onReconnect fired before dial → replaced with onTransportRestore after connect 2.Updated integration tests for scenarios 3 and 5 3.Added unit tests for restore callback
There was a problem hiding this comment.
Pull request overview
This PR updates the client reconnection callback API by removing onReconnect (pre-dial, ambiguous semantics) and introducing onTransportRestore, which fires after a successful reconnect when the new transport is established. This aligns reconnect notifications with a clearer “transport is back” moment and updates the test suite accordingly.
Changes:
- Remove
onReconnectfromClientConfigand stop firing it in the reconnect loop. - Add
onTransportRestoreand invoke it after a successful reconnect. - Update integration/unit tests and add targeted tests for
onTransportRestorebehavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/kotlin/com/wspulse/client/ClientConfig.kt | Replaces onReconnect config hook with onTransportRestore and updates KDoc. |
| src/main/kotlin/com/wspulse/client/WspulseClient.kt | Fires onTransportRestore after a successful reconnect, removing pre-dial onReconnect. |
| src/test/kotlin/com/wspulse/client/ClientIntegrationTest.kt | Updates scenarios to wait for onTransportRestore and adjusts the close-during-reconnect signaling. |
| src/test/kotlin/com/wspulse/client/WspulseClientResourceTest.kt | Updates reconnection-related unit test wiring and adds new tests for onTransportRestore. |
1. Add "Replaces the former onReconnect callback" to onTransportRestore KDoc in ClientConfig.kt 2. Fix onTransportDrop comment in ClientIntegrationTest to clarify it fires before the reconnect loop starts 3. Update README table: onReconnect -> onTransportRestore
1.Variable was set but never asserted → added null check
1.onTransportRestore added, onReconnect removed → [Unreleased]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
onReconnectfromClientConfig(fired before dial, weak semantics)onTransportRestore— fires after successful reconnectTest plan
onTransportRestore fires after successful reconnectonTransportRestore does not fire on initial connectmake checkpasses (lint + tests)./gradlew integrationTestpasses