diff options
| author | Marko Tiikkaja <marko@joh.to> | 2013-12-26 11:27:18 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-12-26 11:27:18 -0800 |
| commit | 0d12e24ebb037202c3324c230e075f1e448f6f34 (patch) | |
| tree | 64e274476326c85550ff485b999dfee77fd4f9c0 /src/pkg/database/sql/sql.go | |
| parent | 59583b09f3165dedd46800f46000c83c92a7faba (diff) | |
| download | go-0d12e24ebb037202c3324c230e075f1e448f6f34.tar.xz | |
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
Diffstat (limited to 'src/pkg/database/sql/sql.go')
| -rw-r--r-- | src/pkg/database/sql/sql.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/database/sql/sql.go b/src/pkg/database/sql/sql.go index 41527c8db1..a0bd051628 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) |
