Configure a connection timeout when connecting to Cloud SQL for PostgreSQL by using the Node.js knex module.
Documentation pages that include this code sample
To view the code sample used in context, see the following documentation:
// 'acquireTimeoutMillis' is the number of milliseconds before a timeout occurs when acquiring a // connection from the pool. This is slightly different from connectionTimeout, because acquiring // a pool connection does not always involve making a new connection, and may include multiple retries. // when making a connection config.pool.acquireTimeoutMillis = 60000; // 60 seconds // 'createTimeoutMillis` is the maximum number of milliseconds to wait trying to establish an // initial connection before retrying. // After acquireTimeoutMillis has passed, a timeout exception will be thrown. config.createTimeoutMillis = 30000; // 30 seconds // 'idleTimeoutMillis' is the number of milliseconds a connection must sit idle in the pool // and not be checked out before it is automatically closed. config.idleTimeoutMillis = 600000; // 10 minutes
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.