diff options
author | Pete Aykroyd <aykroyd@gmail.com> | 2013-03-01 15:18:55 -0500 |
---|---|---|
committer | Pete Aykroyd <aykroyd@gmail.com> | 2013-03-01 15:18:55 -0500 |
commit | 01b1e22a7915838d1b6c135afe337635381cd8f5 (patch) | |
tree | 4b800d72ed1703641d3f7a836a996f77634351d9 /redis/client.py | |
parent | 896740378a6596a84ba4392fce9c068f125a4dad (diff) | |
download | redis-py-01b1e22a7915838d1b6c135afe337635381cd8f5.tar.gz |
Do not discard pipeline unless in multi.
Fixes an error that occurred if you exec'd a pipeline on which you
hadn't called `multi()`. When an error happened, the code was
automatically calling discard. This causes an a 'DISCARD without MULTI'
error from redis which obscures the actual cause of the error.
Diffstat (limited to 'redis/client.py')
-rw-r--r-- | redis/client.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py index 76a1072..8db2b0e 100644 --- a/redis/client.py +++ b/redis/client.py @@ -1741,7 +1741,8 @@ class BasePipeline(object): try: response = self.parse_response(connection, '_') except ExecAbortError: - self.immediate_execute_command('DISCARD') + if self.explicit_transaction: + self.immediate_execute_command('DISCARD') if errors: raise errors[0][1] raise sys.exc_info()[1] |