diff options
author | andy <andy@whiskeymedia.com> | 2011-07-16 16:25:56 -0700 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2011-07-16 16:25:56 -0700 |
commit | c9daf07bb67696263118a17b0359fafa7ac27c53 (patch) | |
tree | a4eb55d55b492ba702cca89b150b0b6d8cfea68f | |
parent | 0697b79b91196a826d05e346b3436fe7ff2cf929 (diff) | |
download | redis-py-c9daf07bb67696263118a17b0359fafa7ac27c53.tar.gz |
Fix for #161. Make sure we release the connection back to the pool after
execute is called in a pipeline.
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | redis/client.py | 10 |
2 files changed, 11 insertions, 2 deletions
@@ -1,3 +1,6 @@ +* 2.4.7 (in developmen) + * Fixed a bug where some connections we're getting released back to the + connection pool during pipelines. * 2.4.6 * Variadic arguments for SADD, SREM, ZREN, HDEL, LPUSH, and RPUSH. Thanks Raphaƫl Vinot. 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: |