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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: action server types #831
fix: action server types #831
Conversation
070a597
to
f71559d
Compare
@JGAntunes would you also review test/test-action-server.js as I believe there is some inconsistency with executioncallback. |
@wayneparrott I reverted the type change. I expanded it to accept a callback, the callback returns the previous type or a promise that resolves for that type. Let me know if you are okay with this change. |
@JGAntunes @fampinheiro appreciate you identifying the callback return type inconsistencies. Additionally in server.js I noticed that cancelCallback is awaited on yet the defaltCancelCallback fn does not return a promise. This leads me to believe that the original coder is attempting to account for the case where the executionCallback and cancelCallback functions could be long running async operations. Thus I believe cancelCallback definition should be modified similarly to your proposed modification of the exeutionCallback return type of
Let's loop @minggangw and others that may know the action api better than me for their thoughts. |
I agree, we need to change this accordingly, and it can be separated into another PR, thanks! |
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.
Thanks for your PR, @wayneparrott pls help to merge it if we decide to submit another PR to resolve the comments.
@JGAntunes again thx for identifying this issue and the suggested fix. The fix LGTM. Are you able to submit a similar fix for the cancelCallback? If no, I'll open a separate PR. |
Hey @wayneparrott 馃憢 I can look into it today 馃憤 |
@JGAntunes no problem. I decided to move forward and merge this PR. I'll open a 2nd PR for the cancelCallback change. |
* fix: ExecuteCallback and GoalCallback definitions * fix register execute callback return Co-authored-by: Filipe Pinheiro <dev@fampinheiro.dev>
Public API Changes
Changes for the TS types for:
ExecuteCallback
for the action serverGoalCallback
for the action serverDescription
Both of these callbacks seem to have wrong types setup. The first one should return a
Promise
which is then resolved in:rclnodejs/lib/action/server.js
Lines 359 to 361 in 73f4036
As for the
GoalCallback
type as per the docs:And based on the code:
rclnodejs/lib/action/server.js
Lines 259 to 261 in 73f4036
I've tested out both of these changes in a local project and they work as expected 馃憤