diff --git a/src/Client.ts b/src/Client.ts index 1716069..2e44c1e 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -33,6 +33,16 @@ export default class MuffinAI extends Client { if (NODE_ENV === 'development') this.on('debug', console.info) this.chatBot.train(this) + setInterval(async () => { + const db = await this.chatBot.db.getConnection() + + await db.beginTransaction() + await db.ping() + await db.commit() + + db.release() + }, 600000) + readdirSync(join(__dirname, 'Commands')).forEach(file => { const a = require(join(__dirname, 'Commands', file)) const b: Command = new a.default() diff --git a/src/Commands/learning_data.ts b/src/Commands/learning_data.ts index c16db08..5c60e5f 100644 --- a/src/Commands/learning_data.ts +++ b/src/Commands/learning_data.ts @@ -15,7 +15,7 @@ export default class extends Command { else return }) msg.channel.send( - `머핀 데이터: ${muffin.length}개\nnsfw 데이터: ${nsfw.length}개` + `머핀 데이터: ${muffin.length}개\nnsfw 데이터: ${nsfw.length}개`, ) db.release() } diff --git a/src/modules/database.ts b/src/modules/database.ts index 7666b37..5645759 100644 --- a/src/modules/database.ts +++ b/src/modules/database.ts @@ -19,10 +19,4 @@ export { BaseData as NSFWData } const database = createPool(config.mysql) -setInterval(async () => { - const db = await database.getConnection() - await db.ping() - db.release() -}, 60000) - export default database