mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
feat(common): add option to enable force closing http connections
This commit is contained in:
@@ -25,4 +25,9 @@ export interface NestApplicationOptions extends NestApplicationContextOptions {
|
||||
* Whether to register the raw request body on the request. Use `req.rawBody`.
|
||||
*/
|
||||
rawBody?: boolean;
|
||||
/**
|
||||
* Force close open HTTP connections. Useful if restarting your application hangs due to
|
||||
* keep-alive connections in the HTTP adapter.
|
||||
*/
|
||||
forceCloseConnections?: boolean;
|
||||
}
|
||||
|
||||
@@ -205,11 +205,13 @@ export class ExpressAdapter extends AbstractHttpAdapter {
|
||||
options.httpsOptions,
|
||||
this.getInstance(),
|
||||
);
|
||||
this.trackOpenConnections();
|
||||
return;
|
||||
} else {
|
||||
this.httpServer = http.createServer(this.getInstance());
|
||||
}
|
||||
|
||||
if (options?.forceCloseConnections === true) {
|
||||
this.trackOpenConnections();
|
||||
}
|
||||
this.httpServer = http.createServer(this.getInstance());
|
||||
this.trackOpenConnections();
|
||||
}
|
||||
|
||||
public registerParserMiddleware(prefix?: string, rawBody?: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user