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
Feature/grpc cancellation #774
Feature/grpc cancellation #774
Conversation
- when client cancels the server stream gets completed too - client introduced disconnection does not throw errors on the client side - release client's event listener on 'end'
Will add more tests over the weekend. |
58f3ca4
to
8058972
Compare
8058972
to
0c8e8fb
Compare
Testing done. Should I squish the commits into one? |
@micmro Thats a nice fix. @kamilmysliwiec Can we get this merged in. |
@kamilmysliwiec That is an awesome feature, would be awesome to have that functionality in place. @kamilmysliwiec Could you please merge it? Waiting for a brighter future. |
@@ -103,7 +105,9 @@ export class ServerGrpc extends Server implements CustomTransportStrategy { | |||
return async (call, callback) => { | |||
const handler = methodHandler(call.request, call.metadata); | |||
const result$ = this.transformToObservable(await handler); | |||
await result$.forEach(data => call.write(data)); | |||
await result$.pipe( | |||
takeUntil(fromEvent(call, 'cancelled')), |
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.
That is the missing feature. Sounds really awesome. Waiting for that feature to be in place. @micmro thanks for that awesome feature.
Great job @micmro 👍 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When a connected
ClientGrpcProxy
unsubscribes the Observable returned for an stream gRPC method the upstream connection stays untouched and the server continuous to send updates, even if no-one's listening.Likewise the Observables
complete
is not getting called.Issue Number: #773
What is the new behavior?
When the client cancels the
ServerGrpc
stops consuming it's Observable and the client'scomplete
gets called.Also:
call
get cleaned upgetService<T>
got tighten, as it can only be akeyof T
- get more help from the comilerDoes this PR introduce a breaking change?
Other information