-
Notifications
You must be signed in to change notification settings - Fork 79
Support waitForAllAcked() for publisher #1138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the waitForAllAcked() feature to publisher objects so that users can block until all published messages are acknowledged. Key changes include:
- Adding type tests for waitForAllAcked() in TypeScript.
- Implementing the native binding in C++ (rcl_publisher_bindings.cpp).
- Exposing the waitForAllAcked() method on the JavaScript Publisher class and adding a corresponding test.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/types/index.test-d.ts | Added type assertions for waitForAllAcked() |
| test/test-publisher.js | Added a test case to verify waitForAllAcked() behavior with subscriptions |
| src/rcl_publisher_bindings.cpp | Implemented native waitForAllAcked() binding with handling of timeout errors |
| lib/publisher.js | Added waitForAllAcked() to the Publisher class |
Comments suppressed due to low confidence (1)
test/test-publisher.js:57
- Using 'String' as a variable name may shadow the built-in String type. Consider renaming it to something like 'msgType' to avoid potential confusion.
const String = 'std_msgs/msg/String';
src/rcl_publisher_bindings.cpp
Outdated
| } | ||
| Napi::Error::New(env, "Failed to wait for all acknowledgements") | ||
| .ThrowAsJavaScriptException(); | ||
| throw env.Undefined(); |
Copilot
AI
May 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider replacing 'throw env.Undefined();' with 'return env.Undefined();' after throwing the error to improve clarity and avoid unnecessary exception propagation.
| throw env.Undefined(); | |
| return env.Undefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds support for the waitForAllAcked() method in the publisher API to allow clients to block until all published messages are acknowledged (or until a timeout occurs).
- Adds type definitions for waitForAllAcked() in the TypeScript tests.
- Implements and exposes waitForAllAcked() in the C++ bindings and in the JavaScript publisher class.
- Introduces a new test case validating the waitForAllAcked() behavior.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/types/index.test-d.ts | Adds TS type check for waitForAllAcked() method |
| test/test-publisher.js | Introduces a test verifying waitForAllAcked() returns true |
| src/rcl_publisher_bindings.cpp | Implements the native waitForAllAcked() binding |
| lib/publisher.js | Adds the waitForAllAcked method with accompanying documentation |
This pull request adds support for the waitForAllAcked() method in the publisher API to allow clients to block until all published messages are acknowledged (or until a timeout occurs). - Adds type definitions for waitForAllAcked() in the TypeScript tests. - Implements and exposes waitForAllAcked() in the C++ bindings and in the JavaScript publisher class. - Introduces a new test case validating the waitForAllAcked() behavior. Fix: #1137
This pull request adds support for the waitForAllAcked() method in the publisher API to allow clients to block until all published messages are acknowledged (or until a timeout occurs).
Fix: #1137