Skip to content
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

fix(napi): no panic when caller stops listening #2010

Merged

Conversation

lbarthon
Copy link
Contributor

This fix is similar to the one in 5b5f616.

In both the then_callback & catch_callback, expect was being called in case the send failed. This means that if we call a function that returns a promise and the received gets closed (the calling thread stopped at the wrong time), this will panic.

In such scenarios, it is fine not to panic. If the receiver doesn't care about the output, we should just let it be.

This fix is similar to the one in napi-rs@5b5f616.

In both the then_callback & catch_callback, expect was being called in case
the send failed. This means that if we call a function that returns a promise
and the received gets closed (the calling thread stopped at the wrong time),
this will panic.

In such scenarios, it is fine not to panic. If the receiver doesn't care about
the output, we should just let it be.
@Brooooooklyn Brooooooklyn changed the title fix(Promise): no panic when caller stops listening fix(napi): no panic when caller stops listening Mar 22, 2024
@Brooooooklyn Brooooooklyn merged commit 15521fb into napi-rs:main Mar 22, 2024
40 of 42 checks passed
@lbarthon lbarthon deleted the lbarthon/promise-callback-expects branch March 22, 2024 14:06
@lbarthon
Copy link
Contributor Author

Hey @Brooooooklyn - sorry for the pings - any idea when you'll be able to tag on top of that?

Brooooooklyn pushed a commit that referenced this pull request Mar 26, 2024
This fix is similar to the one in 5b5f616.

In both the then_callback & catch_callback, expect was being called in case
the send failed. This means that if we call a function that returns a promise
and the received gets closed (the calling thread stopped at the wrong time),
this will panic.

In such scenarios, it is fine not to panic. If the receiver doesn't care about
the output, we should just let it be.
Brooooooklyn pushed a commit that referenced this pull request Mar 26, 2024
This fix is similar to the one in 5b5f616.

In both the then_callback & catch_callback, expect was being called in case
the send failed. This means that if we call a function that returns a promise
and the received gets closed (the calling thread stopped at the wrong time),
this will panic.

In such scenarios, it is fine not to panic. If the receiver doesn't care about
the output, we should just let it be.
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.

None yet

2 participants