aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-09-08 10:18:38 +0200
committerChocobozzz <me@florianbigard.com>2022-09-08 10:19:21 +0200
commit37a04703a4b9829cb9aef6c5bb8835d2fa2f2fbc (patch)
treeb3acf68fdf11b702f7d547aa1e9940066feb5dae
parent5b7e3f276d91b1652fe560c757dc3295b690a8d1 (diff)
downloadPeerTube-37a04703a4b9829cb9aef6c5bb8835d2fa2f2fbc.tar.gz
PeerTube-37a04703a4b9829cb9aef6c5bb8835d2fa2f2fbc.tar.zst
PeerTube-37a04703a4b9829cb9aef6c5bb8835d2fa2f2fbc.zip
Add activeRequests info on db acquire timeout
Can help us to debug sequelize acquire timeout error
-rw-r--r--server.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/server.ts b/server.ts
index 6073d2ea4..63a08f471 100644
--- a/server.ts
+++ b/server.ts
@@ -258,9 +258,16 @@ app.use((err, _req, res: express.Response, _next) => {
258 if (err) { 258 if (err) {
259 error = err.stack || err.message || err 259 error = err.stack || err.message || err
260 } 260 }
261
261 // Handling Sequelize error traces 262 // Handling Sequelize error traces
262 const sql = err.parent ? err.parent.sql : undefined 263 const sql = err?.parent ? err.parent.sql : undefined
263 logger.error('Error in controller.', { err: error, sql }) 264
265 // Help us to debug SequelizeConnectionAcquireTimeoutError errors
266 const activeRequests = err?.name === 'SequelizeConnectionAcquireTimeoutError' && typeof (process as any)._getActiveRequests !== 'function'
267 ? (process as any)._getActiveRequests()
268 : undefined
269
270 logger.error('Error in controller.', { err: error, sql, activeRequests })
264 271
265 return res.fail({ 272 return res.fail({
266 status: err.status || HttpStatusCode.INTERNAL_SERVER_ERROR_500, 273 status: err.status || HttpStatusCode.INTERNAL_SERVER_ERROR_500,