Skip to content

Commit 402e939

Browse files
authored
docs: add documentation for destroy method (#301)
1 parent 6e0f78d commit 402e939

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/ServiceGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,12 @@ private String generateConfigVariable(int number) {
320320
private void generateDestroyMethod() {
321321
// Generates the destroy() method, and calls the destroy() method of
322322
// any runtime plugin that claims to have a destroy method.
323+
if (applicationProtocol.isHttpProtocol()) {
324+
writer.writeDocs("Destroy underlying resources, like sockets. It's usually not necessary to do this.\n"
325+
+ "However in Node.js, it's best to explicitly shut down the client's agent when it is no longer "
326+
+ "needed.\nOtherwise, sockets might stay open for quite a long time before the server terminates "
327+
+ "them.");
328+
}
323329
writer.openBlock("destroy(): void {", "}", () -> {
324330
writer.pushState(CLIENT_DESTROY_SECTION);
325331
for (RuntimeClientPlugin plugin : runtimePlugins) {

0 commit comments

Comments
 (0)