diff options
author | Chocobozzz <me@florianbigard.com> | 2022-09-08 10:18:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-09-08 10:19:21 +0200 |
commit | 37a04703a4b9829cb9aef6c5bb8835d2fa2f2fbc (patch) | |
tree | b3acf68fdf11b702f7d547aa1e9940066feb5dae /server.ts | |
parent | 5b7e3f276d91b1652fe560c757dc3295b690a8d1 (diff) | |
download | PeerTube-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
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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, |