new_feature_sigterm

This commit is contained in:
pedro-php 2025-05-15 16:51:45 -03:00
parent d70e538cbc
commit 98b245c7a3
2 changed files with 14 additions and 1 deletions

View File

@ -2,7 +2,7 @@ services:
api:
container_name: evolution_api_${ENVIROMNENT}
build: .
image: adaptweb/evolution-api:1.2.1
image: adaptweb/evolution-api:1.3.0
restart: always
depends_on:
- redis

View File

@ -145,6 +145,19 @@ async function bootstrap() {
initWA();
onUnexpectedError();
process.on('SIGTERM', () => {
logger.warn('SIGTERM received, shutting down...');
server.close(() => {
logger.info('Server closed, exiting...');
process.exit(0);
});
setTimeout(() => {
logger.error('Could not close connections in time, forcefully exiting');
process.exit(1);
}, 30000);
});
}
bootstrap();