Ensure unusable connections get closed

Fixes a bug where a connection that was marked as unusable didn't
prevent it from getting checked backed into the pool.
pull/2825/head
Jason Wilder 2015-06-08 11:26:56 -06:00
parent 0c6ea32540
commit 8cbda9694e
1 changed files with 3 additions and 1 deletions

View File

@ -43,7 +43,9 @@ func (w *ShardWriter) WriteShard(shardID, ownerID uint64, points []tsdb.Point) e
if !ok {
panic("wrong connection type")
}
defer conn.Close() // return to pool
defer func(conn net.Conn) {
conn.Close() // return to pool
}(conn)
// Build write request.
var request WriteShardRequest