Skip to content

Commit b665e1f

Browse files
committed
Remove all listeners from stream on end and error events for cleanup
1 parent 91655e0 commit b665e1f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/durabletask-js/src/client/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,12 @@ export class TaskHubGrpcClient {
827827
});
828828

829829
stream.on("end", () => {
830+
stream.removeAllListeners();
830831
resolve(historyEvents);
831832
});
832833

833834
stream.on("error", (err: grpc.ServiceError) => {
835+
stream.removeAllListeners();
834836
if (err.code === grpc.status.NOT_FOUND) {
835837
reject(new Error(`An orchestration with the instanceId '${instanceId}' was not found.`));
836838
} else if (err.code === grpc.status.CANCELLED) {

0 commit comments

Comments
 (0)