Files
speckle-server/packages/preview-service/knex.js
T
Iain Sproat d36e2036aa 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
2024-08-26 09:47:27 +01:00

19 lines
566 B
JavaScript

/* eslint-disable camelcase */
'use strict'
module.exports = require('knex')({
client: 'pg',
connection: {
application_name: 'speckle_preview_service',
connectionString:
process.env.PG_CONNECTION_STRING || 'postgres://speckle:speckle@127.0.0.1/speckle'
},
pool: {
min: 0,
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
})