cleaned up db resource leaks
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user