summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorandy <andy@whiskeymedia.com>2011-07-16 16:25:56 -0700
committerandy <andy@whiskeymedia.com>2011-07-16 16:25:56 -0700
commitc9daf07bb67696263118a17b0359fafa7ac27c53 (patch)
treea4eb55d55b492ba702cca89b150b0b6d8cfea68f /redis/client.py
parent0697b79b91196a826d05e346b3436fe7ff2cf929 (diff)
downloadredis-py-c9daf07bb67696263118a17b0359fafa7ac27c53.tar.gz
Fix for #161. Make sure we release the connection back to the pool after
execute is called in a pipeline.
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py
index 039024d..10e5060 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -1334,8 +1334,14 @@ class Pipeline(Redis):
execute = self._execute_transaction
else:
execute = self._execute_pipeline
- conn = self.connection or \
- self.connection_pool.get_connection('MULTI', self.shard_hint)
+
+ conn = self.connection
+ if not conn:
+ conn = self.connection_pool.get_connection('MULTI', self.shard_hint)
+ # assign to self.connection so reset() releases the connection
+ # back to the pool after we're done
+ self.connection = conn
+
try:
return execute(conn, stack)
except ConnectionError: