mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
fix(microservices): cleanup unary call on unsubscribe
This commit is contained in:
@@ -241,13 +241,19 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
|
||||
});
|
||||
}
|
||||
return new Observable(observer => {
|
||||
client[methodName](...args, (error: any, data: any) => {
|
||||
const call = client[methodName](...args, (error: any, data: any) => {
|
||||
if (error) {
|
||||
return observer.error(this.serializeError(error));
|
||||
}
|
||||
observer.next(data);
|
||||
observer.complete();
|
||||
});
|
||||
|
||||
return () => {
|
||||
if (!call.finished) {
|
||||
call.cancel();
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user