The doc comment for database/sql/(*DB).Close says:

// 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.
func (db *DB) Close() error {

I was led astray for quite some time by the "Close then waits" part. I 
thought that meant that the Close method would block (or "wait") until all 
connections that had been issued from the pool had been returned to the 
pool and then closed. It turns out that this is not the case, and I think 
what the comment means is that in-use connections will be closed later, 
after Close returns, once they have completed their work.

I'm considering creating an issue for this and am wondering if anyone has 
an opinion on whether this is actually a problem with the documentation and 
whether it is worth raising.

Thanks,
Toby.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/5d75008b-fcab-4422-b493-a57531a4daddn%40googlegroups.com.

Reply via email to