File tree 3 files changed +16
-0
lines changed
3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,12 @@ export class GrpcConnection implements Connection {
326
326
return stream ;
327
327
}
328
328
329
+ /**
330
+ * Closes and cleans up any resources associated with the GrpcConnection.
331
+ * If a gRPC client has been generated for this connection, the gRPC client
332
+ * is closed. Failure to call terminate on a GrpcConnection can result
333
+ * in leaked resources of the gRPC client.
334
+ */
329
335
terminate ( ) : void {
330
336
if ( this . cachedStub ) {
331
337
this . cachedStub . close ( ) ;
Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ export interface Connection {
92
92
*/
93
93
readonly shouldResourcePathBeIncludedInRequest : boolean ;
94
94
95
+ /**
96
+ * Closes and cleans up any resources associated with the connection. Actual
97
+ * resources cleaned are implementation specific. Failure to call `terminate`
98
+ * on a connection may result in resource leaks.
99
+ */
95
100
terminate ( ) : void ;
96
101
97
102
// TODO(mcg): subscribe to connection state changes.
Original file line number Diff line number Diff line change @@ -190,6 +190,11 @@ export abstract class RestConnection implements Connection {
190
190
return `${ this . baseUrl } /${ RPC_URL_VERSION } /${ path } :${ urlRpcName } ` ;
191
191
}
192
192
193
+ /**
194
+ * Closes and cleans up any resources associated with the connection. This
195
+ * implementation is a no-op because there are no resources associated
196
+ * with the RestConnection that need to be cleaned up.
197
+ */
193
198
terminate ( ) : void {
194
199
// No-op
195
200
}
You can’t perform that action at this time.
0 commit comments