Add activeRequests info on db acquire timeout
Can help us to debug sequelize acquire timeout error
This commit is contained in:
parent
5b7e3f276d
commit
37a04703a4
1 changed files with 9 additions and 2 deletions
11
server.ts
11
server.ts
|
@ -258,9 +258,16 @@ app.use((err, _req, res: express.Response, _next) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
error = err.stack || err.message || err
|
error = err.stack || err.message || err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handling Sequelize error traces
|
// Handling Sequelize error traces
|
||||||
const sql = err.parent ? err.parent.sql : undefined
|
const sql = err?.parent ? err.parent.sql : undefined
|
||||||
logger.error('Error in controller.', { err: error, sql })
|
|
||||||
|
// Help us to debug SequelizeConnectionAcquireTimeoutError errors
|
||||||
|
const activeRequests = err?.name === 'SequelizeConnectionAcquireTimeoutError' && typeof (process as any)._getActiveRequests !== 'function'
|
||||||
|
? (process as any)._getActiveRequests()
|
||||||
|
: undefined
|
||||||
|
|
||||||
|
logger.error('Error in controller.', { err: error, sql, activeRequests })
|
||||||
|
|
||||||
return res.fail({
|
return res.fail({
|
||||||
status: err.status || HttpStatusCode.INTERNAL_SERVER_ERROR_500,
|
status: err.status || HttpStatusCode.INTERNAL_SERVER_ERROR_500,
|
||||||
|
|
Loading…
Reference in a new issue