fix(server): database connection pool timeouts reduced (#2646)
* fix(server): database connection pool timeouts reduced - previous acquisition timeout was 60s; this is reduced to 16s for faster responsiveness - this allows for 3x attempts of 5s each to create a connection, plus idle time between attempts * Apply to other knex instances
This commit is contained in:
Родитель
a5061eceff
Коммит
d36e2036aa
|
@ -10,7 +10,9 @@ module.exports = require('knex')({
|
|||
},
|
||||
pool: {
|
||||
min: 0,
|
||||
max: parseInt(process.env.POSTGRES_MAX_CONNECTIONS_FILE_IMPORT_SERVICE) || 1
|
||||
max: parseInt(process.env.POSTGRES_MAX_CONNECTIONS_FILE_IMPORT_SERVICE) || 1,
|
||||
acquireTimeoutMillis: 16000, //allows for 3x creation attempts plus idle time between attempts
|
||||
createTimeoutMillis: 5000
|
||||
}
|
||||
// migrations are in managed in the server package
|
||||
})
|
||||
|
|
|
@ -10,7 +10,9 @@ module.exports = require('knex')({
|
|||
},
|
||||
pool: {
|
||||
min: 0,
|
||||
max: parseInt(process.env.POSTGRES_MAX_CONNECTIONS_PREVIEW_SERVICE) || 2
|
||||
max: parseInt(process.env.POSTGRES_MAX_CONNECTIONS_PREVIEW_SERVICE) || 2,
|
||||
acquireTimeoutMillis: 16000, //allows for 3x creation attempts plus idle time between attempts
|
||||
createTimeoutMillis: 5000
|
||||
}
|
||||
// migrations are in managed in the server package
|
||||
})
|
||||
|
|
|
@ -92,7 +92,12 @@ const commonConfig = {
|
|||
},
|
||||
// we wish to avoid leaking sql queries in the logs: https://knexjs.org/guide/#compilesqlonerror
|
||||
compileSqlOnError: false,
|
||||
pool: { min: 0, max: postgresMaxConnections() }
|
||||
pool: {
|
||||
min: 0,
|
||||
max: postgresMaxConnections(),
|
||||
acquireTimeoutMillis: 16000, //allows for 3x creation attempts plus idle time between attempts
|
||||
createTimeoutMillis: 5000
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {Object<string, import('knex').Knex.Config>} */
|
||||
|
|
|
@ -10,7 +10,9 @@ module.exports = require('knex')({
|
|||
},
|
||||
pool: {
|
||||
min: 0,
|
||||
max: parseInt(process.env.POSTGRES_MAX_CONNECTIONS_WEBHOOK_SERVICE) || 1
|
||||
max: parseInt(process.env.POSTGRES_MAX_CONNECTIONS_WEBHOOK_SERVICE) || 1,
|
||||
acquireTimeoutMillis: 16000, //allows for 3x creation attempts plus idle time between attempts
|
||||
createTimeoutMillis: 5000
|
||||
}
|
||||
// migrations are in managed in the server package
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче