Fix keep-alive timeout and remove fs.stat() overhead from downloads

This commit is contained in:
Trevor Renshaw 2026-05-16 09:19:01 -06:00
parent cf0a432027
commit e74dbf5f40
2 changed files with 13 additions and 13 deletions

View file

@ -301,6 +301,11 @@ class Server {
app.disable('x-powered-by')
this.server = http.createServer(app)
// Keep connections alive for 120s so multi-file downloads don't pay a new
// TCP handshake per file. Default Node.js keepAliveTimeout is only 5s,
// which causes connections to drop mid-download for files > 5s.
this.server.keepAliveTimeout = 120000
this.server.headersTimeout = 125000
router.use(
fileUpload({