diff options
-rw-r--r-- | CHANGES | 1 | ||||
-rwxr-xr-x | redis/connection.py | 7 |
2 files changed, 5 insertions, 3 deletions
@@ -18,6 +18,7 @@ connections should require the server hostname to match the hostname specified in the SSL cert. By default 'ssl_check_hostname' is False for backwards compatibility. #1196 + * Slightly optimized command packing. Thanks @Deneby67. #1255 * 3.3.11 * Further fix for the SSLError -> TimeoutError mapping to work on obscure releases of Python 2.7. diff --git a/redis/connection.py b/redis/connection.py index 926f2c7..b27bf21 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -757,15 +757,16 @@ class Connection(object): for arg in imap(self.encoder.encode, args): # to avoid large string mallocs, chunk the command into the # output list if we're sending large values - if len(buff) > buffer_cutoff or len(arg) > buffer_cutoff: + arg_length = len(arg) + if len(buff) > buffer_cutoff or arg_length > buffer_cutoff: buff = SYM_EMPTY.join( - (buff, SYM_DOLLAR, str(len(arg)).encode(), SYM_CRLF)) + (buff, SYM_DOLLAR, str(arg_length).encode(), SYM_CRLF)) output.append(buff) output.append(arg) buff = SYM_CRLF else: buff = SYM_EMPTY.join( - (buff, SYM_DOLLAR, str(len(arg)).encode(), + (buff, SYM_DOLLAR, str(arg_length).encode(), SYM_CRLF, arg, SYM_CRLF)) output.append(buff) return output |