-
-
Notifications
You must be signed in to change notification settings - Fork 254
Description
Description
Currently it is possible to configure a maximum connexion lifetime for the database connexion pool (which correspond to the underlaying function sql.SetConnMaxLifetime: https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime), but there is no way (unless there is one ?) to configure the connexion maximum lifetime for the idle connexions (sql.SetConnMaxIdleTime: https://golang.org/pkg/database/sql/#DB.SetConnMaxIdleTime)
In my use case I need to set a maximum connexion lifetime for the idle connexions so that the connexion pool entirely disconnect from the database after a period of innactivity. The main goal is to allow our RDS serverless database to scale down when no request are made so that we can save on cost.
Steps to Reproduce the Problem
I create my connexion with the following code:
connDetails := &pop.ConnectionDetails{
URL: <URL to the database>,
IdlePool: 8,
ConnMaxLifetime: time.Duration(30 * time.Second),
Pool: 16,
Options: <an optional map of option>,
}
c, err = pop.NewConnection(connDetails)
if err != nil {
panic(err)
}
if err := c.Open(); err != nil {
panic(err)
}Please, keep in mind that those values are just example values for my demonstration
Expected Behavior
I expect to be able to update the connexion max idle time
Info
Not that it matters but I'm running a proud Ubuntu 20.10 with go1.16.2.
I'm using pop in version 5.3.3