diff options
author | Giuseppe Lavagetto <lavagetto@gmail.com> | 2014-01-13 12:10:12 +0100 |
---|---|---|
committer | Giuseppe Lavagetto <lavagetto@gmail.com> | 2014-01-13 12:10:12 +0100 |
commit | c32539e137cc49d86f74fac24efc63703edff2df (patch) | |
tree | fdd70a3647af7aaea1052e8fa4c2fcecf5640054 /src | |
parent | 8832d9625b6e70211a3111657ebf1d7f8e89b96e (diff) |
adding timeouts in the relevant places.
Diffstat (limited to 'src')
-rw-r--r-- | src/etcd/lock.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/etcd/lock.py b/src/etcd/lock.py index adf7ee5..c862243 100644 --- a/src/etcd/lock.py +++ b/src/etcd/lock.py @@ -41,14 +41,14 @@ class Lock(object): def _path(self): return u'/mod/v2/lock{}'.format(self.key) - def acquire(self): + def acquire(self, timeout=None): """Acquire the lock from etcd. Blocks until lock is acquired.""" params = {u'ttl': self.ttl} if self.value is not None: params[u'value'] = self.value res = self.client.api_execute( - self._path, self.client._MPOST, params=params) + self._path, self.client._MPOST, params=params, timeout=timeout) self._index = res.data.decode('utf-8') return self @@ -91,7 +91,7 @@ class Lock(object): self._path, self.client._MDELETE, params=params) self._index = None - def renew(self, new_ttl): + def renew(self, new_ttl, timeout=None): """ Renew the TTL on this lock. |