From 75b6b31501eda24a37a8786aa10c2eb34b98973e Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 22 Jul 2020 13:19:52 -0700 Subject: [PATCH] Don't log Cancelled warning when strem is closed (#3450) --- .../src/platform/node/grpc_connection.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/firestore/src/platform/node/grpc_connection.ts b/packages/firestore/src/platform/node/grpc_connection.ts index 467f3c56353..13bdf0f6bb4 100644 --- a/packages/firestore/src/platform/node/grpc_connection.ts +++ b/packages/firestore/src/platform/node/grpc_connection.ts @@ -230,15 +230,17 @@ export class GrpcConnection implements Connection { }); grpcStream.on('error', (grpcError: ServiceError) => { - logWarn( - LOG_TAG, - 'GRPC stream error. Code:', - grpcError.code, - 'Message:', - grpcError.message - ); - const code = mapCodeFromRpcCode(grpcError.code); - close(new FirestoreError(code, grpcError.message)); + if (!closed) { + logWarn( + LOG_TAG, + 'GRPC stream error. Code:', + grpcError.code, + 'Message:', + grpcError.message + ); + const code = mapCodeFromRpcCode(grpcError.code); + close(new FirestoreError(code, grpcError.message)); + } }); logDebug(LOG_TAG, 'Opening GRPC stream');