MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / ConnectionPool

Method ConnectionPool

pkg/management/postgres/instance.go:938–954  ·  view source on GitHub ↗

ConnectionPool gets or initializes the connection pool for this instance

()

Source from the content-addressed store, hash-verified

936
937// ConnectionPool gets or initializes the connection pool for this instance
938func (instance *Instance) ConnectionPool() pool.Pooler {
939 const applicationName = "cnpg-instance-manager"
940 if instance.pool == nil {
941 socketDir := GetSocketDir()
942 dsn := fmt.Sprintf(
943 "host=%s port=%v user=%v sslmode=disable application_name=%v",
944 socketDir,
945 GetServerPort(),
946 "postgres",
947 applicationName,
948 )
949
950 instance.pool = pool.NewPostgresqlConnectionPool(dsn)
951 }
952
953 return instance.pool
954}
955
956// metricsConnectionPool gets or initializes the connection pool used by the metrics exporter.
957func (instance *Instance) metricsConnectionPool() pool.Pooler {

Callers 2

GetSuperUserDBMethod · 0.95
GetTemplateDBMethod · 0.95

Calls 3

GetSocketDirFunction · 0.85
GetServerPortFunction · 0.85

Tested by

no test coverage detected