From: David-Sarah Hopwood Date: Fri, 15 Feb 2013 20:59:06 +0000 (+0000) Subject: openstack_container.py: improve name of _auth_lock; simplify by using DeferredLock... X-Git-Url: https://git.rkrishnan.org/reliability?a=commitdiff_plain;h=bc45bc1ac6e87fbdd4e6df7ce543004cf2857cd8;p=tahoe-lafs%2Ftahoe-lafs.git openstack_container.py: improve name of _auth_lock; simplify by using DeferredLock.run. Signed-off-by: David-Sarah Hopwood --- diff --git a/src/allmydata/storage/backends/cloud/openstack/openstack_container.py b/src/allmydata/storage/backends/cloud/openstack/openstack_container.py index 0aa20996..b1b40052 100644 --- a/src/allmydata/storage/backends/cloud/openstack/openstack_container.py +++ b/src/allmydata/storage/backends/cloud/openstack/openstack_container.py @@ -77,7 +77,7 @@ class AuthenticationClient(object): # Not authorized yet. self._auth_info = None - self._first_auth_lock = defer.DeferredLock() + self._auth_lock = defer.DeferredLock() d = self.get_auth_info() d.addBoth(lambda ign: None) @@ -89,12 +89,7 @@ class AuthenticationClient(object): return self.get_auth_info_locked() def get_auth_info_locked(self, suppress_errors=False): - d = self._first_auth_lock.acquire() - d.addCallback(self._authenticate) - def _release(res): - self._first_auth_lock.release() - return res - d.addBoth(_release) + d = self._auth_lock.run(self._authenticate) d.addCallback(lambda ign: self._auth_info) if suppress_errors: d.addErrback(lambda ign: self._auth_info)