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

successful calls still emit 'cancelled' as of v1.10.x #2771

Closed
davidfiala opened this issue Jun 5, 2024 · 2 comments
Closed

successful calls still emit 'cancelled' as of v1.10.x #2771

davidfiala opened this issue Jun 5, 2024 · 2 comments

Comments

@davidfiala
Copy link
Contributor

I was working on adding v1.10.x support to the https://github.com/deeplay-io/nice-grpc repos.

As lightly documented in deeplay-io/nice-grpc#555 (comment) I believe I discovered that server call handlers emit 'cancelled' even on successful RPCs. The v1.9.x series does not appear to do this. It appears to have been introduced behavior in the server-interceptor.ts file in 1.10.0 merge.

Is the behavior of always emitting call cancelled an explicit intention? Or a possible bug?

Thanks for your time.

@murgatroid99
Copy link
Member

Yes, that was intentional.

From my point of view, the primary purpose of the cancelled signal is to notify the handler and any interceptors that no more processing is needed, and any resources associated with the call can be discarded, when they might otherwise not know that. Previously, that would only happen because of network events or calling Server#forceShutdown, but now it can also happen if a server interceptor ends a call on its own. As a result, the simplest way to ensure that the handler always gets that notification is to emit the cancelled event if the call ends in any way.

@davidfiala
Copy link
Contributor Author

Thank you for the clarification.

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

No branches or pull requests

2 participants