From 8cbda9694e8139ef84a526607399fc4058d79b1f Mon Sep 17 00:00:00 2001 From: Jason Wilder Date: Mon, 8 Jun 2015 11:26:56 -0600 Subject: [PATCH] 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. --- cluster/shard_writer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cluster/shard_writer.go b/cluster/shard_writer.go index 6210c73f72..27718e38d5 100644 --- a/cluster/shard_writer.go +++ b/cluster/shard_writer.go @@ -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