Open fr1t2 opened 1 month ago
Example from GPT conversation:
const Sequelize = require('sequelize'); const sequelize = new Sequelize('database', 'username', 'password', { host: 'localhost', dialect: 'mysql', pool: { max: 5, min: 0, acquire: 30000, idle: 10000 } }); // Handle the Ctrl+C signal process.on('SIGINT', async () => { console.log('Gracefully shutting down...'); try { await sequelize.close(); console.log('Database connection closed'); process.exit(0); // Exit the process after closing the connection } catch (err) { console.error('Error while closing the database connection:', err); process.exit(1); } }); // Your bot logic here // Example: Simulate bot running setInterval(() => { console.log('Bot is running...'); }, 5000);
Example from GPT conversation: