salesforce / reactive-grpc

Reactive stubs for gRPC
BSD 3-Clause "New" or "Revised" License
833 stars 118 forks source link

Subscription Should be Cancelled on Interceptor Close #304

Closed jGleitz closed 1 year ago

jGleitz commented 1 year ago

When an interceptor closes the call, the reactive subscription is not cancelled. This means that any resource allocated for a call are not removed, either, and effectively leak.

To circumvent this, I think the library should listen ServerCall.Listener.onComplete and ServerCall.Listener.onCancel, and cancel its subscription of the reactive sequence in reaction to it (if the sequence hasn’t completed yet).

jGleitz commented 1 year ago

Here’s a fix and a test case reproducing the issue: #305

jGleitz commented 1 year ago

@rmichela thank you for reviewing & merging so quickly! Do you have the chance to publish a release? We’d like to profit from the changes as soon as possible.

rmichela commented 1 year ago

I lost my publish rights when I left Salesforce. Still working on getting someone to fill that role.