Skip to content

Commit 2580b9f

Browse files
committed
Adding documentation for the terminate() method on the Connection classes.
1 parent 9c8f590 commit 2580b9f

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

packages/firestore/src/platform/node/grpc_connection.ts

+6
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,12 @@ export class GrpcConnection implements Connection {
326326
return stream;
327327
}
328328

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+
*/
329335
terminate(): void {
330336
if (this.cachedStub) {
331337
this.cachedStub.close();

packages/firestore/src/remote/connection.ts

+5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ export interface Connection {
9292
*/
9393
readonly shouldResourcePathBeIncludedInRequest: boolean;
9494

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+
*/
95100
terminate(): void;
96101

97102
// TODO(mcg): subscribe to connection state changes.

packages/firestore/src/remote/rest_connection.ts

+5
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ export abstract class RestConnection implements Connection {
190190
return `${this.baseUrl}/${RPC_URL_VERSION}/${path}:${urlRpcName}`;
191191
}
192192

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+
*/
193198
terminate(): void {
194199
// No-op
195200
}

0 commit comments

Comments
 (0)