summaryrefslogtreecommitdiff
path: root/ext/http/01_http.js
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2021-09-10 15:47:09 -0700
committerGitHub <noreply@github.com>2021-09-10 15:47:09 -0700
commitfa963909e5c48cacd60cc02db200927611fa8e91 (patch)
tree049887e4cbdc3cd9538077fa23d461814b671041 /ext/http/01_http.js
parent87052927afd505ff1c5d42075cd23a3619b29011 (diff)
perf(ext/http): optimize auto cleanup of request resource (#11978)
Fixes #11963.
Diffstat (limited to 'ext/http/01_http.js')
-rw-r--r--ext/http/01_http.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js
index 2e742d097..6e3bb5c80 100644
--- a/ext/http/01_http.js
+++ b/ext/http/01_http.js
@@ -297,13 +297,12 @@
ws[_eventLoop]();
}
- } else {
+ } else if (typeof requestRid === "number") {
// Try to close "request" resource. It might have been already consumed,
- // but if it hasn't been we need to close it here to avoid resource leak.
- try {
- SetPrototypeDelete(httpConn.managedResources, requestRid);
- core.close(requestRid);
- } catch { /* pass */ }
+ // but if it hasn't been we need to close it here to avoid resource
+ // leak.
+ SetPrototypeDelete(httpConn.managedResources, requestRid);
+ core.tryClose(requestRid);
}
};
}