From 555c9284e23eebfa5b0e541653a7ef480e791132 Mon Sep 17 00:00:00 2001 From: Migan178 Date: Wed, 4 Oct 2023 21:35:14 +0900 Subject: [PATCH] . --- src/Client.ts | 10 ++++++++++ src/Commands/learning_data.ts | 2 +- src/modules/database.ts | 6 ------ 3 files changed, 11 insertions(+), 7 deletions(-) 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