Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix set_multi method when all items in mapping are greater than… #97

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions memcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,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 = []
Expand All @@ -914,6 +915,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))
Expand All @@ -927,6 +929,9 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0,
if noreply:
return notstored

if not has_valid_content:
return mapping.keys()

# if any servers died on the way, don't expect them to respond.
for server in dead_servers:
del server_keys[server]
Expand Down