From 839f429f707bc7f528e49625af974cf2ab1bde38 Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Tue, 18 Jan 2022 10:13:12 -0500 Subject: [PATCH] fix: add close() in the wrapper (#986) * fix: add close in the wrapper * fix format * fix * return one type * simplify code * clean up code --- src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.ts b/src/index.ts index e1f7112a3..20473afc5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -883,6 +883,16 @@ export class Bigtable { } } + /** + * Terminate grpc channels and close all the clients. + */ + close(): Promise { + const combined = Object.keys(this.api).map(clientType => + this.api[clientType].close() + ); + return Promise.all(combined); + } + /** * Determine and localize the project ID. If a user provides an ID, we bypass * checking with the auth client for an ID.