fix(socketio): concurrent acknowledgement timeouts#709
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR resolves confusing timeout behavior when broadcasting with acknowledgements across remote adapters by aligning ack-stream timeouts with both the adapter request timeout and the ack timeout.
Changes:
- Expose the globally configured ack timeout via a new
SocketEmitter::ack_timeout()API (and forward it throughCoreLocalAdapter). - Update Redis and MongoDB adapters to use
request_timeout + ack_timeoutfor the ack stream timeout. - Bump crate versions and update changelogs/lockfile accordingly.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/socketioxide/src/ns.rs | Implements the new SocketEmitter::ack_timeout() getter on the server-side emitter. |
| crates/socketioxide/src/ack.rs | Minor rename/clarification of the timeout parameter used for per-socket ack waiting. |
| crates/socketioxide/CHANGELOG.md | Notes the newly exposed ack-timeout getter. |
| crates/socketioxide/Cargo.toml | Updates dependency version for socketioxide-core. |
| crates/socketioxide-redis/src/lib.rs | Adjusts ack-stream timeout to include request timeout + (custom/default) ack timeout. |
| crates/socketioxide-redis/CHANGELOG.md | Adds release note for the ack/request timeout race fix. |
| crates/socketioxide-redis/Cargo.toml | Bumps crate version and core dependency version. |
| crates/socketioxide-mongodb/tests/fixture.rs | Adds a test fixture helper to configure request timeout. |
| crates/socketioxide-mongodb/src/lib.rs | Adjusts ack-stream timeout to include request timeout + (custom/default) ack timeout. |
| crates/socketioxide-mongodb/CHANGELOG.md | Adds release note for the ack/request timeout race fix. |
| crates/socketioxide-mongodb/Cargo.toml | Bumps crate version and core dependency version. |
| crates/socketioxide-core/src/adapter/mod.rs | Adds ack_timeout() to the SocketEmitter trait and forwards via CoreLocalAdapter. |
| crates/socketioxide-core/CHANGELOG.md | Adds a changelog entry for the new ack-timeout exposure. |
| crates/socketioxide-core/Cargo.toml | Bumps the core crate version. |
| Cargo.lock | Updates resolved versions for bumped crates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Motivation
When broadcasting with acks, the adapter request timeout is applied on the acknowledgement stream. By default,
request_timeout = 5sandack_timeout = 5s. Because the two timeouts are independently enforced, this leads to the request timeouts not respecting the ack timeout and creates confusing errors.Solution
self.config.request_timeout + timeout.unwrap_or(self.local.ack_timeout())for redis and mongodb adapters