Skip to content

Commit

Permalink
Fixed set_multi serialization performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Marshall Quander committed May 10, 2012
1 parent f74f94e commit 5e43ab3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions memcache.py
Expand Up @@ -589,7 +589,8 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
dead_servers = []

for server in server_keys.keys():
bigcmd = bytes()
bigcmd = bytearray()
write = bigcmd.extend
try:
newline = "\r\n".encode('utf-8')
for key in server_keys[server]: # These are mangled keys
Expand All @@ -599,8 +600,8 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
cmd += store_info[2].encode('utf-8')
else:
cmd += store_info[2]
bigcmd += cmd + newline
server.send_cmds(bigcmd)
write(cmd + newline)
server.send_cmds(bytes(bigcmd))
except socket.error as msg:
if type(msg) is tuple: msg = msg[1]
server.mark_dead(msg)
Expand Down

0 comments on commit 5e43ab3

Please sign in to comment.