File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,18 @@ class Spanner extends GrpcService {
268268 } ;
269269 }
270270
271+ /** Closes this Spanner client and cleans up all resources used by it. */
272+ close ( ) : void {
273+ this . clients_ . forEach ( c => {
274+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
275+ const client = c as any ;
276+ if ( client . operationsClient && client . operationsClient . close ) {
277+ client . operationsClient . close ( ) ;
278+ }
279+ client . close ( ) ;
280+ } ) ;
281+ }
282+
271283 createInstance (
272284 name : string ,
273285 config : CreateInstanceRequest
Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ describe('Spanner with mock server', () => {
147147 } ) ;
148148
149149 after ( ( ) => {
150+ spanner . close ( ) ;
150151 server . tryShutdown ( ( ) => { } ) ;
151152 delete process . env . SPANNER_EMULATOR_HOST ;
152153 sandbox . restore ( ) ;
You can’t perform that action at this time.
0 commit comments