cleaned up db resource leaks

This commit is contained in:
2025-12-14 16:53:40 -05:00
parent 81ae9ebea1
commit 011439fb19
4 changed files with 19 additions and 11 deletions

View File

@@ -207,8 +207,9 @@ router.post('/:id/comment', [requireLogin], async (req: Request, res: Response)
)
VALUES(?, ?, ?);`
try {
const conn = await pool.getConnection();
var conn = await pool.getConnection();
const result = await conn.query(sql, [appID, user.id, data])
console.log(result)
@@ -232,6 +233,8 @@ VALUES(?, ?, ?);`
} catch (err) {
console.error('Comment failed:', err);
res.status(500).json({ error: 'Could not post comment' });
} finally {
conn.release();
}
});
@@ -252,7 +255,7 @@ router.post('/:id/adminComment', [requireLogin, requireRole("Recruiter")], async
VALUES(?, ?, ?, 1);`
try {
const conn = await pool.getConnection();
var conn = await pool.getConnection();
const result = await conn.query(sql, [appID, user.id, data])
console.log(result)
@@ -277,6 +280,8 @@ VALUES(?, ?, ?, 1);`
} catch (err) {
console.error('Comment failed:', err);
res.status(500).json({ error: 'Could not post comment' });
} finally {
conn.release();
}
});