@@ -75,26 +75,27 @@ const connect = () => {
7575 // Additional connections will be established to meet this value unless the pool is full.
7676 knex . client . pool . min = 5 ;
7777 // [END cloud_sql_postgres_knex_limit]
78+
7879 // [START cloud_sql_postgres_knex_timeout]
79- // 'acquireTimeoutMillis' is the maximum number of milliseconds to wait for a connection checkout.
80- // Any attempt to retrieve a connection from this pool that exceeds the set limit will throw an
81- // SQLException.
80+ // 'acquireTimeoutMillis' is the number of milliseconds before a timeout occurs when acquiring a
81+ // connection from the pool. This is slightly different from connectionTimeout, because acquiring
82+ // a pool connection does not always involve making a new connection, and may include multiple retries.
83+ // when making a connection
84+ knex . client . pool . acquireTimeoutMillis = 60000 ; // 60 seconds
85+ // 'createTimeoutMillis` is the maximum number of milliseconds to wait trying to establish an
86+ // initial connection before retrying.
87+ // After acquireTimeoutMillis has passed, a timeout exception will be thrown.
8288 knex . client . pool . createTimeoutMillis = 30000 ; // 30 seconds
83- // 'idleTimeoutMillis' is the maximum amount of time a connection can sit in the pool. Connections that
84- // sit idle for this many milliseconds are retried if idleTimeoutMillis is exceeded .
89+ // 'idleTimeoutMillis' is the number of milliseconds a connection must sit idle in the pool
90+ // and not be checked out before it is automatically closed .
8591 knex . client . pool . idleTimeoutMillis = 600000 ; // 10 minutes
8692 // [END cloud_sql_postgres_knex_timeout]
93+
8794 // [START cloud_sql_postgres_knex_backoff]
95+ // 'knex' uses a built-in retry strategy which does not implement backoff.
8896 // 'createRetryIntervalMillis' is how long to idle after failed connection creation before trying again
8997 knex . client . pool . createRetryIntervalMillis = 200 ; // 0.2 seconds
9098 // [END cloud_sql_postgres_knex_backoff]
91- // [START cloud_sql_postgres_knex_lifetime]
92- // 'acquireTimeoutMillis' is the maximum possible lifetime of a connection in the pool. Connections that
93- // live longer than this many milliseconds will be closed and reestablished between uses. This
94- // value should be several minutes shorter than the database's timeout value to avoid unexpected
95- // terminations.
96- knex . client . pool . acquireTimeoutMillis = 600000 ; // 10 minutes
97- // [START cloud_sql_postgres_knex_lifetime]
9899
99100 // [END_EXCLUDE]
100101 return knex ;
0 commit comments