enable shutdown hooks

This commit is contained in:
mertalev 2023-09-11 02:03:52 -04:00
parent 5d1011b482
commit c9ddfe2b30
No known key found for this signature in database
GPG key ID: 9181CD92C0A1C5E3
2 changed files with 4 additions and 4 deletions

View file

@ -14,8 +14,8 @@ const port = Number(process.env.SERVER_PORT) || 3001;
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
export async function bootstrap() { export async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule, { logger: getLogLevels() }); const app = await NestFactory.create<NestExpressApplication>(AppModule, { logger: getLogLevels(), forceCloseConnections: true });
app.enableShutdownHooks();
app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']); app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']);
app.set('etag', 'strong'); app.set('etag', 'strong');
app.use(cookieParser()); app.use(cookieParser());

View file

@ -10,8 +10,8 @@ const port = Number(process.env.MICROSERVICES_PORT) || 3002;
const envName = (process.env.NODE_ENV || 'development').toUpperCase(); const envName = (process.env.NODE_ENV || 'development').toUpperCase();
export async function bootstrap() { export async function bootstrap() {
const app = await NestFactory.create(MicroservicesModule, { logger: getLogLevels() }); const app = await NestFactory.create(MicroservicesModule, { logger: getLogLevels(), forceCloseConnections: true });
app.enableShutdownHooks();
app.useWebSocketAdapter(new RedisIoAdapter(app)); app.useWebSocketAdapter(new RedisIoAdapter(app));
await app.get(AppService).init(); await app.get(AppService).init();