From 24b691e452375c2d9086165275f29c7390fa024d Mon Sep 17 00:00:00 2001 From: Vinicius Ronconi Date: Thu, 16 Jun 2016 07:22:51 -0300 Subject: [PATCH 1/2] Fix set_multi method when all items in mapping are greater than self.server_max_value_length. When it happens, servers are marked as dead and next commands will for some seconds (according to _DEAD_RETRY value) --- memcache.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/memcache.py b/memcache.py index 9823a2f..82c5bc6 100644 --- a/memcache.py +++ b/memcache.py @@ -910,6 +910,7 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0, # send out all requests on each server before reading anything dead_servers = [] notstored = [] # original keys. + has_valid_content = False for server in six.iterkeys(server_keys): bigcmd = [] @@ -926,6 +927,7 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0, noreply, b'\r\n', val, b'\r\n') write(fullcmd) + has_valid_content = True else: notstored.append(prefixed_to_orig_key[key]) server.send_cmds(b''.join(bigcmd)) @@ -939,6 +941,9 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0, if noreply: return notstored + if not has_valid_content: + return notstored + # if any servers died on the way, don't expect them to respond. for server in dead_servers: del server_keys[server] From 637b61a4b80a1feccdcdc9a42869b4a834f09d49 Mon Sep 17 00:00:00 2001 From: Vinicius Ronconi Date: Thu, 16 Jun 2016 07:22:51 -0300 Subject: [PATCH 2/2] Fix set_multi method when all items in mapping are greater than self.server_max_value_length. When it happens, servers are marked as dead and next commands will for some seconds (according to _DEAD_RETRY value) --- memcache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcache.py b/memcache.py index 82c5bc6..2183407 100644 --- a/memcache.py +++ b/memcache.py @@ -942,7 +942,7 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0, return notstored if not has_valid_content: - return notstored + return mapping.keys() # if any servers died on the way, don't expect them to respond. for server in dead_servers: