From: Simon J Mudd Date: Wed, 28 Jan 2015 07:36:26 +0000 (+0100) Subject: Limit the pool size to avoid issues if existing connections get stuck X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=3337f4c92dfc74b821d492b8b6dc4be126554c83;p=pstop.git Limit the pool size to avoid issues if existing connections get stuck --- diff --git a/main.go b/main.go index 0197e83..facfa65 100644 --- a/main.go +++ b/main.go @@ -59,6 +59,9 @@ func connect_by_defaults_file( defaults_file string ) *sql.DB { log.Fatal(err) } + // deliberately limit the pool size to 5 to avoid "problems" if any queries hang. + dbh.SetMaxOpenConns(5) // hard-coded value! + return dbh }