]> Cypherpunks repositories - gostls13.git/commitdiff
database/sql: clarify behavior of DB.Close
authorDaniel Theophanes <kardianos@gmail.com>
Thu, 29 Mar 2018 17:01:27 +0000 (10:01 -0700)
committerDaniel Theophanes <kardianos@gmail.com>
Wed, 11 Apr 2018 19:26:17 +0000 (19:26 +0000)
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>
src/database/sql/sql.go

index c8666653ba89eb4c49cb7593aa122e4169ee7118..355b6aa300a1f3622179c62a29b735e57413a954 100644 (file)
@@ -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.