Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented May 19, 2025

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

@minggangw minggangw requested a review from Copilot May 19, 2025 09:35
Copy link

Copilot AI left a 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';

}
Napi::Error::New(env, "Failed to wait for all acknowledgements")
.ThrowAsJavaScriptException();
throw env.Undefined();
Copy link

Copilot AI May 19, 2025

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.

Suggested change
throw env.Undefined();
return env.Undefined();

Copilot uses AI. Check for mistakes.
@minggangw minggangw requested a review from Copilot May 19, 2025 09:39
Copy link

Copilot AI left a 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

@coveralls
Copy link

Coverage Status

coverage: 84.752% (+0.005%) from 84.747%
when pulling 30415e1 on minggangw:fix-1137
into 711e42a on RobotWebTools:develop.

@minggangw minggangw merged commit 67e5203 into RobotWebTools:develop May 20, 2025
29 of 35 checks passed
minggangw added a commit that referenced this pull request May 23, 2025
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
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.

Support rcl_publisher_wait_for_all_acked

2 participants