Skip to content

Commit

Permalink
libindex: limit MaxConns in controller pool to 1
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Zmeskal <[email protected]>
  • Loading branch information
Jan Zmeskal authored and ldelossa committed Feb 11, 2021
1 parent 533316c commit 2cf7d4a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libindex/controllerfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package libindex
import (
"context"
"fmt"
"time"

"github.com/jackc/pgx/v4/pgxpool"

Expand All @@ -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)
Expand Down

0 comments on commit 2cf7d4a

Please sign in to comment.