Skip to content

Commit

Permalink
Add support to disable connection pooling
Browse files Browse the repository at this point in the history
  • Loading branch information
mna committed Oct 12, 2023
1 parent d8c71db commit 5aef5f5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ccheck/ccheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ var (
readTimeoutFlag = flag.Duration("r", 100*time.Millisecond, "Read `timeout`.")
writeTimeoutFlag = flag.Duration("w", 100*time.Millisecond, "Write `timeout`.")

refreshFlag = flag.Bool("f", false, "Perform a cluster refresh before starting.")
retryConnFlag = flag.Bool("R", false, "Use a single retry connection.")
refreshFlag = flag.Bool("f", false, "Perform a cluster refresh before starting.")
retryConnFlag = flag.Bool("R", false, "Use a single retry connection.")
disablePoolFlag = flag.Bool("P", false, "Disable connection pooling.")

maxIdleFlag = flag.Int("max-idle", 10, "Maximum idle `connections` per pool.")
maxActiveFlag = flag.Int("max-active", 100, "Maximum active `connections` per pool.")
Expand Down Expand Up @@ -62,6 +63,10 @@ func main() {
}
defer cluster.Close()

if *disablePoolFlag {
cluster.CreatePool = nil
}

if *refreshFlag {
if err := cluster.Refresh(); err != nil {
log.Fatalf("failed to refresh cluster: %v", err)
Expand Down

0 comments on commit 5aef5f5

Please sign in to comment.