fix memory leak, close file after serve

This commit is contained in:
HorizonCode committed 2023-05-12 14:49:21 +02:00
1 parent 4e1ac5888a
commit 784a34ed4d
1 file changed
+2
+2
View File
@@ -169,12 +169,14 @@ export class HTTPServer {
const readableStream = file.readable;
const response = new Response(readableStream);
if (middlewarePromise) {
const pt = performance.now() - perStart;
const hrArray: number[] = [0, Math.trunc(pt * 1000000)];
resolveAction(hrArray);
}
await requestEvent.respondWith(response);
file.close(); // close file after serve
return;
}