2 Commits

Author SHA1 Message Date
winter.liang c58565af77 fix: increase DB pool size and fix connection leak in permissions route
- connectionLimit 10 -> 50, queueLimit 0 -> 100 to prevent pool exhaustion
- Add missing db.release() in GET /permissions/:id finally block
2026-04-24 14:20:39 +08:00
Edison 66d29fa4b6 change to request format on the txt 2026-03-26 16:54:17 +08:00
3 changed files with 26 additions and 2 deletions
+2
View File
@@ -826,6 +826,8 @@ export default function () {
res
.status(500)
.json({ message: 'Database error fetching manager permissions.', details: error.message })
} finally {
db.release()
}
})
+2 -2
View File
@@ -13,8 +13,8 @@ const db = mysql.createPool({
database: process.env.DB_NAME,
port: process.env.DB_PORT,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0,
connectionLimit: 50,
queueLimit: 100,
// timezone: '+08:00',
dateStrings: true,
});
+22
View File
@@ -0,0 +1,22 @@
import { getConnection } from './pool.js'
// import mysql from 'mysql2/promise'
//
//
//
// export const db = mysql.createPool({
// host: '47.254.195.2',
// user: 'nilai_clock_indo',
// password: '5jHy8ZsfeEjPAhYS',
// database: 'nilai_clock_indo',
// port: 3306,
// waitForConnections: true,
// connectionLimit: 10,
// queueLimit: 0,
// dateStrings: true,
// // 不在这里设置timezone,因为我们用查询设置
// });
const conn = await getConnection()
const [rows] = await conn.execute('select * from clock_records where id= 6654');
console.log(rows);