From 2cf7d4ad5002677f3f8e0baf047d66acbe93ea47 Mon Sep 17 00:00:00 2001 From: Jan Zmeskal Date: Wed, 10 Feb 2021 16:48:05 +0100 Subject: [PATCH] libindex: limit MaxConns in controller pool to 1 Signed-off-by: Jan Zmeskal --- libindex/controllerfactory.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libindex/controllerfactory.go b/libindex/controllerfactory.go index b094d4066..60acbd25d 100644 --- a/libindex/controllerfactory.go +++ b/libindex/controllerfactory.go @@ -3,6 +3,7 @@ package libindex import ( "context" "fmt" + "time" "github.com/jackc/pgx/v4/pgxpool" @@ -23,6 +24,8 @@ func controllerFactory(ctx context.Context, lib *Libindex, opts *Opts) (*control if err != nil { return nil, fmt.Errorf("failed to parse ConnString: %v", err) } + cfg.MaxConns = 1 + cfg.MaxConnIdleTime = time.Minute * 5 pool, err := pgxpool.ConnectConfig(ctx, cfg) if err != nil { return nil, fmt.Errorf("failed to create ConnPool: %v", err)