Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
WIP: longer keepalive and headers timeouts (#75)
Browse files Browse the repository at this point in the history
* Try increasing keepalive and headers timeouts to prevent socket hang ups

* Bump version
  • Loading branch information
MattiasOlla authored Aug 7, 2024
1 parent 0c9940a commit a5542c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import config from "exp-config";
import { logger } from "lu-logger";
import * as fs from "fs";
import { logger } from "lu-logger";
import * as path from "path";

import shutdownHandler from "./lib/shutdownHandler.js";
import buildApp from "./lib/build-app.js";
import { registerServerTerminator } from "./lib/handle-sigterm.js";
import { render404, render409, renderError } from "./lib/render-error.js";
import shutdownHandler from "./lib/shutdownHandler.js";
import validator from "./lib/validator.js";
import buildApp from "./lib/build-app.js";

export function init(routes) {
const app = buildApp(routes);
Expand All @@ -17,6 +17,9 @@ export function init(routes) {

const port = Number(process.env.PORT) || config.port || 3000;
const server = app.listen(port, () => {
server.keepAliveTimeout = 120 * 1000;
server.headersTimeout = 130 * 1000;

logger.info(`${packageInfo.name} listening on port ${server.address().port}`);
});
logger.info("initiating sigterm handler with shutdown handler");
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lu-server",
"version": "9.0.0",
"version": "9.1.0",
"engines": {
"node": ">=18 <=20",
"yarn": "please use npm"
Expand Down

0 comments on commit a5542c9

Please sign in to comment.