Skip to content

Instantly share code, notes, and snippets.

@rystsov
Last active September 7, 2015 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rystsov/55b68e8ef68b977598b1 to your computer and use it in GitHub Desktop.
Save rystsov/55b68e8ef68b977598b1 to your computer and use it in GitHub Desktop.
def put(self, test, val, timeout):
due = now() + timeout
while due > now():
result = self._read_write_read(test, val, due)
if isinstance(result, NetworkError): continue
return result # OK or Conflict
return NetworkError()
def get(self, timeout):
return self.put(None, None, timeout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment