aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql
diff options
context:
space:
mode:
authorDaniel Theophanes <kardianos@gmail.com>2018-03-29 10:01:27 -0700
committerDaniel Theophanes <kardianos@gmail.com>2018-04-11 19:26:17 +0000
commit7a7b63f3e749e3608ee16b1807349a778d562c08 (patch)
treed9add5915295341f1468be39b0fcc2f094a827c7 /src/database/sql
parent8e43c37229835b420637f1230a1ca2a4d58fa017 (diff)
downloadgo-7a7b63f3e749e3608ee16b1807349a778d562c08.tar.xz
database/sql: clarify behavior of DB.Close
It wasn't clear for existing docs if DB.Close forcefully closed connections or waited for them to finish. Fixes #23753 Change-Id: Id7df31224c93181c8d01bab7b0b23da25b42a288 Reviewed-on: https://go-review.googlesource.com/103397 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/database/sql')
-rw-r--r--src/database/sql/sql.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go
index c8666653ba..355b6aa300 100644
--- a/src/database/sql/sql.go
+++ b/src/database/sql/sql.go
@@ -738,7 +738,9 @@ func (db *DB) Ping() error {
return db.PingContext(context.Background())
}
-// Close closes the database, releasing any open resources.
+// Close closes the database and prevents new queries from starting.
+// Close then waits for all queries that have started processing on the server
+// to finish.
//
// It is rare to Close a DB, as the DB handle is meant to be
// long-lived and shared between many goroutines.