mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-14 16:07:42 +00:00
tweak postgres connection
This commit is contained in:
parent
9d0c5fb419
commit
45793c9a1f
1 changed files with 3 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/DataDog/datadog-go/statsd"
|
"github.com/DataDog/datadog-go/statsd"
|
||||||
"github.com/adjust/rmq/v4"
|
"github.com/adjust/rmq/v4"
|
||||||
|
@ -68,7 +69,8 @@ func NewDatabasePool(ctx context.Context, maxConns int) (*pgxpool.Pool, error) {
|
||||||
// Setting the build statement cache to nil helps this work with pgbouncer
|
// Setting the build statement cache to nil helps this work with pgbouncer
|
||||||
config.ConnConfig.BuildStatementCache = nil
|
config.ConnConfig.BuildStatementCache = nil
|
||||||
config.ConnConfig.PreferSimpleProtocol = true
|
config.ConnConfig.PreferSimpleProtocol = true
|
||||||
|
config.MaxConnLifetime = 1 * time.Hour
|
||||||
|
config.MaxConnIdleTime = 30 * time.Second
|
||||||
return pgxpool.ConnectConfig(ctx, config)
|
return pgxpool.ConnectConfig(ctx, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue