aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/database/sql/sql.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-02-27 22:43:10 -0500
committerBrad Fitzpatrick <bradfitz@golang.org>2014-02-27 22:43:10 -0500
commitd905670c2ee3efe6b08d6c8de292be46f1e1eca1 (patch)
tree8d3776becdb2b3c882bd584495e0374022d4fb19 /src/pkg/database/sql/sql.go
parent402d3590b54e4a0df9fb51ed14b2999e85ce0b76 (diff)
downloadgo-d905670c2ee3efe6b08d6c8de292be46f1e1eca1.tar.xz
[release-branch.go1.2] database/sql: Use all connections in pool
««« CL 40410043 / 8a7ac002f840 database/sql: Use all connections in pool The last connection in the pool was not being handed out correctly. R=golang-codereviews, gobot, bradfitz CC=golang-codereviews https://golang.org/cl/40410043 »»» LGTM=r R=golang-codereviews, r CC=golang-dev https://golang.org/cl/68820044
Diffstat (limited to 'src/pkg/database/sql/sql.go')
-rw-r--r--src/pkg/database/sql/sql.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/database/sql/sql.go b/src/pkg/database/sql/sql.go
index dddf5a3f25..84a0965132 100644
--- a/src/pkg/database/sql/sql.go
+++ b/src/pkg/database/sql/sql.go
@@ -620,8 +620,8 @@ func (db *DB) conn() (*driverConn, error) {
}
// If db.maxOpen > 0 and the number of open connections is over the limit
- // or there are no free connection, then make a request and wait.
- if db.maxOpen > 0 && (db.numOpen >= db.maxOpen || db.freeConn.Len() == 0) {
+ // and there are no free connection, make a request and wait.
+ if db.maxOpen > 0 && db.numOpen >= db.maxOpen && db.freeConn.Len() == 0 {
// Make the connRequest channel. It's buffered so that the
// connectionOpener doesn't block while waiting for the req to be read.
ch := make(chan interface{}, 1)